WordPress MU Domain Mapping and mu-plugins wrong URLs
-
Hello valued developers!
First of all, thanks for this awesome plugin, I mean it, it actually help people around the world to create not just online networks, but jobs and better webs! ??
So, yasterday I installed Front-end Editor plugin as a mu-plugin in my network to find out that it wasn’t working because the URLs for the JS and CSS needed files inside the plugin were wrong (very wrong, https://www.ads-software.com/support/topic/plugin-front-end-editor-frontend-editor-and-wordpress-mu-domain-mapping-plugins?replies=2#post-2610913), after some research and some thoughts (https://davoscript.com/2012/02/07/front-end-editor-and-wordpress-mu-domain-mapping-plugins/) shared with Scribu, Front-end Editor author, I came to check MU Domain Mapping’s code and found what I think is a small bug:
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 ); }
PLUGINDIR (which seems to be deprecated) stores “wp-content/plugins” so the match will fail it the passed URL in the $full_url variable contains “wp-content/mu-plugins” instead, I replaced it with:
// 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; }
You can check the whole article I wront about this issue here: https://davoscript.com/2012/02/08/wordpress-mu-domain-mapping-plugin-and-multisite-mu-plugins/
As I state in my website, this is not an official fix, that’s why I’m showing you this so you can actually tell if this is the propper way to fix the issue and help other people too.
Thanks again for your time and effort.
Best regards,
David.https://www.ads-software.com/extend/plugins/wordpress-mu-domain-mapping/
- The topic ‘WordPress MU Domain Mapping and mu-plugins wrong URLs’ is closed to new replies.