0

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.com - Main site

2- siteb.com - Should use site.com database except for the theme & plugin

3- sitec.com - Should use site.com database except for the theme & plugin

Is there any way this can be done?

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.com') === 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.