• Hello Community!

    We are running a network with several customers under one domain. We have implemented a payment provider plugin that is activated for the whole network. Because we want to offer not only online shops but also order systems with no payment method but the payment in the local store (which is not possible with the payment plugin), we wanted to deactivate the plugin just for this site. I can not (or I am scared) to deactivate it for the whole network and then activate it manually for every site that needs it again.

    So there are basically two options and questions:
    1. Can I deactivate it just for one site somehow, when the plugin is actually activated for the whole network?
    2. Can I deactivate the network wide activation and activate it on the subdomains again without losing all settings (with that I would only have do deal with the effort and the customer can no longer accept payments as long as it is deactivated)?

    I am very glad for any sort of help.

    Best regards

    Benjamin

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello @benjie93 ,

    This snippet should do the trick, add this to your themes functions.php or a custom plugin, change 16 to the id of the site you need to target and change the cloudflare/cloudflare.php example to the proper plugin directory and file.
    If you later remove this snippet from theme/custom plugin the plugin will return to it’s original network active status.

    As always test on your dev site first.

    add_filter('site_option_active_sitewide_plugins', 'deactivate_sitewide_plugins_by_site_id');
    function deactivate_sitewide_plugins_by_site_id($value)
    {
        global $current_blog;
        /*---Using site id 16 for example, change to meet your needs------*/
        if ($current_blog->blog_id == 16) {
            /*----Remove cloudflare plugns= from the network active status------*/
            unset($value['cloudflare/cloudflare.php']);
        }
    
        return $value;
    }
    Thread Starter benjie93

    (@benjie93)

    Hey @wvfitzgerald ,

    Thank you very much for your fast and very detailed answer. I will it as you suggested!

    Best regards

    Benjamin

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Deactivate a network-wide-activated Plug-In’ is closed to new replies.