php - Multiple WordPress sites with different theme and plugin sharing the same content

admin2025-06-05  3

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 badges
Add a comment  | 

1 Answer 1

Reset to default 0

This 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.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749103536a316390.html

最新回复(0)