Created
March 5, 2014 23:43
-
-
Save danielbachhuber/9379135 to your computer and use it in GitHub Desktop.
Fix network admin URL to include the "/wp/" base
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Fix network admin URL to include the "/wp/" base | |
* | |
* @see https://core.trac.wordpress.org/ticket/23221 | |
*/ | |
add_filter( 'network_site_url', function( $url, $path, $scheme ){ | |
$urls_to_fix = array( | |
'/wp-admin/network/', | |
'/wp-login.php', | |
'/wp-activate.php', | |
'/wp-signup.php', | |
); | |
foreach( $urls_to_fix as $maybe_fix_url ) { | |
$fixed_wp_url = '/wp' . $maybe_fix_url; | |
if ( false !== stripos( $url, $maybe_fix_url ) | |
&& false === stripos( $url, $fixed_wp_url ) ) { | |
$url = str_replace( $maybe_fix_url, $fixed_wp_url, $url ); | |
} | |
} | |
return $url; | |
}, 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment