0

Here is the context: I have a sub domains wp mu install with wp-content in a different location and using the domain mapping plugin. WP and all my plugins are up to date. There is no https involved.

The problem: Some plugins are not working properly (Metaslider, Google Analytics to Dashboard), enqueue JS and css paths are wrong. It seems to always appear when plugins use : define( 'RANDOMNAME', plugin_dir_path( __FILE__ ) );.

Url without domain mapping : http://bcwp.guillaumemolter.me/wp-app-content/plugins/google-analytics-dashboard-for-wp/front/css/item-reports.css?ver=4.8.1.2

Url with domain mapping : http://blackcake-whiteplate.comp/front/css/item-reports.css?ver=4.8.1.2

Everything works perfectly without the domain mapping.

I also tried to force define in my wp-config but it doesn't change anything:

define( 'WP_CONTENT_DIR', dirname( __FILE__ ) . '/wp-app-content' );
define( 'WP_CONTENT_URL', 'http://' . $_SERVER['HTTP_HOST'] . '/wp-app-content' );
define( 'WP_PLUGIN_DIR', dirname( __FILE__ ) . '/wp-app-content/plugins' );
define( 'WP_PLUGIN_URL', 'http://' . $_SERVER['HTTP_HOST'] . '/wp-app-content/plugins' );

Any Suggestions??

wp-config

<?php

/* Local settings contains DB Credentials, SALTS and the DOMAIN_CURRENT_SITE */
if(file_exists(dirname(__FILE__) . '/' . 'local-settings.php')){
    require_once(dirname(__FILE__) . '/' . 'local-settings.php');   
}
else{
    die(dirname(__FILE__) . '/' . "local-settings.php is missing, please read the repo's readme.md");
}

/**
 * WordPress Database Table prefix.
 *
 * You can have multiple installations in one database if you give each a unique
 * prefix. Only numbers, letters, and underscores please!
 */
$table_prefix  = 'molterwpmu_';


/** Relocating the wp-content folder out of wordpress  */

define( 'WP_CONTENT_DIR', dirname( __FILE__ ) . '/wp-app-content' );
define( 'WP_CONTENT_URL', 'http://' . $_SERVER['HTTP_HOST'] . '/wp-app-content' );

define( 'WP_PLUGIN_DIR', dirname( __FILE__ ) . '/wp-app-content/plugins' );
define( 'WP_PLUGIN_URL', 'http://' . $_SERVER['HTTP_HOST'] . '/wp-app-content/plugins' );

/** Disabling file editing from the admin  */

define('DISALLOW_FILE_EDIT', true);

/** Network setup  */
define( 'WP_ALLOW_MULTISITE', true );
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', true);
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

/** Domain mapping  */
define( 'SUNRISE', 'on' );

/* That's all, stop editing! Happy blogging. */

/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
    define('ABSPATH', dirname(__FILE__) . '/');

/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');

htaccess

# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) wp-app/$1 [L]
RewriteRule ^(.*\.php)$ wp-app/$1 [L]
RewriteRule . index.php [L]

# END WordPress

1 Answer 1

0

The solution, adding this to my wp-config.php:

define( 'PLUGINDIR', 'wp-app-content/plugins' );

https://wordpress.org/support/topic/domain-mapping-breaks-some-plugin-scripts-and-css

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.