Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WP Multisite fix for WP install in a directory
<?php
/*
Our Wordpress is located in https://our-site.com/wordpress
Here's the relevant part of our wp-config.php
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', true);
define('DOMAIN_CURRENT_SITE', 'our-site.com');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
However the "Lost your password" URL on http://our-site.com/wordpress/login.php it then set to: https://our-site.com/wp-login.php?action=lostpassword - so the /wordpress part is missing.
Put this into wp-content/mu-plugins
*/
define('FV_PATH_CURRENT_SITE', '/site/');
add_filter( 'network_site_url', 'fv_network_site_url' );
function fv_network_site_url( $url ) {
$current_site = get_current_site();
if( strcmp($current_site->domain. $current_site->path, $current_site->domain.FV_PATH_CURRENT_SITE) ) {
$url = str_replace( $current_site->domain. $current_site->path, $current_site->domain.FV_PATH_CURRENT_SITE, $url );
}
return $url;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.