Support » Plugin: WordPress MU Domain Mapping » 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,, after some research and some thoughts ( 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 );
        $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:

    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,

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Ron Rennick


    MultiSite Guru

    Thanks for the tip on the mu-plugins substitution 🙂

    Using those hard-coded strings will work fine for you as long as you are using the default directory structure, but we can’t change the plugin to use the hard-coded strings instead of the constants. Doing that would break the plugin for anyone who has a custom wp-content, plugins or mu-plugins directory.

    You are super-right, I actually was trying to generate the right URL with functions from the API, but then I tried this and I was like “ok , perfect” but was too sleepy anyway.. haha.

    The problem that I see is that you can’t do something like grab the whole URL and substr the “home ulr” because they are different:

    In the plugin_url filter you recieve:

    But all the functions I’ve tried to get wordpress URLs use the mapped domain instead, like:

    This makes it hard to substr the first part of the URL 🙁

    Anyway, I’ll be updating this thread if I have more luck.

    Thanks a lot for your time Ron, I don’t know if you realize, but sharing some lines with you guys, code rockstarts! is just amazing! 😀


Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘WordPress MU Domain Mapping and mu-plugins wrong URLs’ is closed to new replies.