After writing Front-end Editor and WordPress MU Domain Mapping plugins and sharing some thoughts with its author: Scribu, I’ve found that the real problem with the wrong URLs for the files inside the “mu-plugins” folder is actually a filter function added by WordPress MU Domain Mapping plugin which tries to recreate the URLs with the new mapped domain instead of the URL used by WordPress in multisite mode (subdomains or subdirectories). So here is a copy of my post in the WordPress forums:
You can also find the following post at: http://wordpress.org/support/topic/plugin-front-end-editor-frontend-editor-and-wordpress-mu-domain-mapping-plugins?replies=2#post-2610913
From WordPress Forums:
People, I’ve been commeting about this on my website with Scribu http://davoscript.com/2012/02/07/front-end-editor-and-wordpress-mu-domain-mapping-plugins/#comments and after some research I’ve found that the problem is actually with WordPress MU Domain Mapping plugi, check out this code:
domain_mapping.php Line #656
// fixes the plugins_url
function domain_mapping_plugins_uri( $full_url, $path=NULL, $plugin=NULL ) {
return get_option( 'siteurl' ) . substr( $full_url, stripos( $full_url, PLUGINDIR ) - 1 );
}
function domain_mapping_themes_uri( $full_url ) {
return str_replace( get_original_url ( 'siteurl' ), get_option( 'siteurl' ), $full_url );
}
if ( defined( 'DOMAIN_MAPPING' ) ) {
add_filter( 'plugins_url', 'domain_mapping_plugins_uri', 1 );
...
}
The domain_mapping_plugins_uri function is used to filter the plugins_url function and return the plugins folder (or file inside it) url with the mapped domain, it does it by searching “wp-content/plugins” but it fails when the plugin is loaded from the “wp-content/mu-plugins”. This can be fixed by validating if the passed URL contains the “mu-plugins” string or not.
This is the fix I added:
// fixes the plugins_url
function domain_mapping_plugins_uri( $full_url, $path=NULL, $plugin=NULL ) {
if ( false !== strpos($full_url, 'wp-content/mu-plugins') )
$mapped_url = get_option( 'siteurl' ) . substr( $full_url, stripos( $full_url, 'wp-content/mu-plugins' ) - 1 );
else
$mapped_url = get_option( 'siteurl' ) . substr( $full_url, stripos( $full_url, 'wp-content/plugins' ) - 1 );
return $mapped_url;
}
Note that I use “wp-content/plugins” and “wp-content/mu-plugins” instead of the “PLUGINDIR” constant which is deprecated by the way.
Please not that this is not an official fix, since I’m not the author of the plugin, however I hope this can solve this problem for other people as it did for me, so you can enjoy and empower your network with this 2 amazing wordpress plugins!
Regards,
Davo.