WordPress MU Domain Mapping
domain_mapping_plugins_uri breaks plugins installed in mu-plugins (3 posts)

  1. Janis Elsts
    Posted 2 years ago #


    WordPress MU Domain Mapping maps URLs that point to files in the /wp-content/mu-plugins directory incorrectly. This breaks plugins that are installed in that directory and need to load some JS/CSS dependencies to function.


    For some inexplicable reason, this plugin attaches two URL mapping callbacks to the plugins_url hook - domain_mapping_plugins_uri and domain_mapping_post_content. The first callback - domain_mapping_plugins_uri - relies on the deprecated PLUGINDIR constant, so it returns the wrong result when the original URL points to wp-content/mu-plugins instead of wp-content/plugins.


    a) Remove the redundant domain_mapping_plugins_uri filter by deleting this line and the corresponding function:

    add_filter( 'plugins_url', 'domain_mapping_plugins_uri', 1 );

    b) Add some error checking to domain_mapping_plugins_uri so that it doesn't break URLs that point to a directory other than wp-content/plugins:

    function domain_mapping_plugins_uri( $full_url, $path=NULL, $plugin=NULL ) {
    	$plugin_dir_pos = stripos( $full_url, PLUGINDIR );
    	//Skip URLs that don't point to files in /wp-content/plugins.
    	if ( $plugin_dir_pos === false ) {
    		return $full_url;
    	return get_option( 'siteurl' ) . substr( $full_url, $plugin_dir_pos - 1 );


  2. Ron Rennick
    MultiSite Guru
    Plugin Author

    Posted 2 years ago #

    Thanks for reporting that - It's on my list to fix.

  3. wLc Designs
    Posted 1 year ago #

    Thanks for the save Janis.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WordPress MU Domain Mapping
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.