Support » Plugin: WordPress MU Domain Mapping » [Plugin: WordPress MU Domain Mapping] Problems with custom wp-content directory

  • Hello,

    When wp-content is renamed, MU Domain Mapping does not return the proper plugin url for the mapped domain.

    Quick overview of the problem
    Using the standard wp-content install, things work as expected:
    Mapped domain =
    <?php echo plugins_url();?> on returns

    but when wp-content is renamed and moved:
    Mapped domain =
    <?php echo plugins_url();?> on returns http://themapped.coms

    Two things happen, the letter ‘s’ is appended to and the plugin path is not returned.

    Configuration Details
    I’ve been rubbing up on this problem for a few days. I’ve been able to reproduce the error both locally and live across every install tested.

    Let’s assume the default (blog_id=1) domain for the multi-site install =

    And we want to change wp-content to content, so the defines I declare in wp-config.php are:
    /******* Move WP-Content Directory *******/
    define( ‘WP_CONTENT_DIR’, $_SERVER[‘DOCUMENT_ROOT’] . ‘/content’ );
    define( ‘WP_CONTENT_URL’, ‘’);

    We restart the server and everything seems to work, except on the mapped domain, the output of plugins_url() = http://themapped.coms

    So I tried a different way. I kept wp-content and moved the plugin directories to /library. In wp-config.php I declare:
    /******* Define New Location of Plugin Directory *******/
    define( ‘WP_PLUGIN_DIR’, $_SERVER[‘DOCUMENT_ROOT’] . ‘/library/plugins’ );
    define( ‘WP_PLUGIN_URL’, ‘’);
    define( ‘WPMU_PLUGIN_DIR’, $_SERVER[‘DOCUMENT_ROOT’] . ‘/library/mu-plugins’ );
    define( ‘WPMU_PLUGIN_URL’, ‘’);

    The same problem occurs where plugins_url() on returns http://mymapped.coms

    I tried various combinations of moving wp-content and plugins. At least the dang plugins_url() output remained constant! http://mymapped.coms 🙂

    Other Notes
    The problem isn’t limited to mapped domains, but only mapped domains break. Mapped domains don’t get any path to the plugins directory and get the ‘s’ appended.

    Non mapped domains do not break because the path to the plugins directory is returned as the path for the default domain of the install. That is if is the default, and is a subsite, then
    plugins_url() on =

    It’s entirely possible that the fix is minor. Lines 650-653 of domain_mapping.php seems to be a culprit

    // 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 );

    Thanks for your help!

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


    For the purposes of testing, I just added

    define( 'WP_CONTENT_URL', '');

    to my wp-config.php and

    <?php echo plugins_url();?>


    If you want the URL to be then you should have the following in your wp-config.php

    define( 'WP_CONTENT_URL', 'http://' . $_SERVER['HTTP_HOST'] . '/content');

    That does return the correct hostname for subdomains, but mapped domains are still borked.

    <?php echo plugins_url();?>

    on still returns http://anymapped.coms

    I think the culprit might be function domain_mapping_plugins_uri

    I couldn’t fix the function, but when I comment out the filter, it works as it should.

    if ( defined( 'DOMAIN_MAPPING' ) ) {
    //	add_filter( 'plugins_url', 'domain_mapping_plugins_uri', 1 );
    	add_filter( 'theme_root_uri', 'domain_mapping_themes_uri', 1 );
    	add_filter( 'pre_option_siteurl', 'domain_mapping_siteurl' );

    Could that be it?

    Plugin Author Ron Rennick


    Try adding the following to your wp-config

    define( 'PLUGINDIR', 'content/plugins' );

    Ron, that’s it. Works perfect.

    Earlier I had tried

    define( 'PLUGINDIR', $_SERVER['DOCUMENT_ROOT'] . '/content/plugins' );

    Which didn’t work, and quickly abandoned the idea of using PLUGINSDIR (ticket #18772)

    Summary for posterity
    To move /wp-content to /content define the following in wp-config.php:

    define( 'WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/content' );
    define( 'WP_CONTENT_URL', 'http://' . $_SERVER['HTTP_HOST'] . '/content');
    define( 'PLUGINDIR', 'content/plugins' );

    Mapped domains will play nice throughout the install and work flawlessly with third party plugins like, Gravity Forms, and Network plugins.

    Wheeew doggie.

    Thanks Ron.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: WordPress MU Domain Mapping] Problems with custom wp-content directory’ is closed to new replies.