域映射破坏了一些插件脚本和CSS

时间:2015-07-28 作者:guillaume.molter

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 个回复
最合适的回答,由SO网友:guillaume.molter 整理而成

解决方案,将其添加到我的wp配置中。php:

定义(\'PLUGINDIR\',\'wp-app-content/plugins\');

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

结束

相关推荐

WordPress MultiSite,整个站点的HTTPS,还是只是管理员?

我有一个具有子域结构和通配符SSL证书的wp multiste。我的multiste已为任何创建站点的人启用注册。我知道如何做到这两点:1。只有管理员才有https或https 2。https无处不在(前端和管理)。我不知道该选哪一个。Wordpress。com在其所有用户的网站上到处都有https,据我所知,谷歌在2014年宣布,他们提高了使用https的网站的排名。似乎到处都有https是很好的理由。当然,https可能会减慢网站的速度。所以到处都有https有很多好处吗。还有,为什么前端会有http