admin管理员组文章数量:1130349
I want run Multiple Wordpress websites with different theme and plugin using one database where the content remains the same in all websites.
1- site - Main site
2- siteb - Should use site database except for the theme & plugin
3- sitec - Should use site database except for the theme & plugin
Is there any way this can be done?
I want run Multiple Wordpress websites with different theme and plugin using one database where the content remains the same in all websites.
1- site - Main site
2- siteb - Should use site database except for the theme & plugin
3- sitec - Should use site database except for the theme & plugin
Is there any way this can be done?
Share Improve this question edited Dec 13, 2018 at 7:11 F.A asked Dec 12, 2018 at 19:25 F.AF.A 255 bronze badges1 Answer
Reset to default 0This is not really a "multisite" case, as it's really just the one site content with a single database.
What you could do is detect when the subsite hostname is being used, probably by matching $_SERVER['HTTP_HOST'] in a must-use plugin... (if you don't create the subsites explicitly, your domain setup would need to allow "wildcard" subdomains.)
So that for each subdomain match, you can filter the active_plugins and stylesheet options via the option_{$key} filters which are used in get_option when the site is loading... eg.
add_filter('option_active_plugins', 'get_subsite_active_plugins');
function check_subsite_active_plugins($plugins) {
if (strpos($_SERVER['HTTP_HOST'], '1.site') === 0) {
$plugins = array('hello-dolly.php');
}
return $plugins;
}
However, you need to remember that if any changes are made to the database by a plugin or theme on any of the sites, it will affect all the sites. It some cases this might cause instability, but it is really hard to say depending on the plugins/themes.
Note there are some solutions out there already for using multiple themes, but nothing I know of specifically for having different plugin configurations like this.
Be aware also, there may be SEO ramifications to having "duplicate" content across subdomains, but there may be some way around that.
I want run Multiple Wordpress websites with different theme and plugin using one database where the content remains the same in all websites.
1- site - Main site
2- siteb - Should use site database except for the theme & plugin
3- sitec - Should use site database except for the theme & plugin
Is there any way this can be done?
I want run Multiple Wordpress websites with different theme and plugin using one database where the content remains the same in all websites.
1- site - Main site
2- siteb - Should use site database except for the theme & plugin
3- sitec - Should use site database except for the theme & plugin
Is there any way this can be done?
Share Improve this question edited Dec 13, 2018 at 7:11 F.A asked Dec 12, 2018 at 19:25 F.AF.A 255 bronze badges1 Answer
Reset to default 0This is not really a "multisite" case, as it's really just the one site content with a single database.
What you could do is detect when the subsite hostname is being used, probably by matching $_SERVER['HTTP_HOST'] in a must-use plugin... (if you don't create the subsites explicitly, your domain setup would need to allow "wildcard" subdomains.)
So that for each subdomain match, you can filter the active_plugins and stylesheet options via the option_{$key} filters which are used in get_option when the site is loading... eg.
add_filter('option_active_plugins', 'get_subsite_active_plugins');
function check_subsite_active_plugins($plugins) {
if (strpos($_SERVER['HTTP_HOST'], '1.site') === 0) {
$plugins = array('hello-dolly.php');
}
return $plugins;
}
However, you need to remember that if any changes are made to the database by a plugin or theme on any of the sites, it will affect all the sites. It some cases this might cause instability, but it is really hard to say depending on the plugins/themes.
Note there are some solutions out there already for using multiple themes, but nothing I know of specifically for having different plugin configurations like this.
Be aware also, there may be SEO ramifications to having "duplicate" content across subdomains, but there may be some way around that.
本文标签: phpMultiple WordPress sites with different theme and plugin sharing the same content
版权声明:本文标题:php - Multiple WordPress sites with different theme and plugin sharing the same content 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749103511a2316372.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论