1

On a multisite network, I have some plugins that are network activated so they run on every site in the network. However, I want to disable all of the network active plugins on some of the sites.

How can I do this?

2

Multisite-wide active plugins are stored in the active_sitewide_plugins site option. We can hook into this option and return an empty array (no plugins are active).

This snippet should be installed as a Must-Use Plugin.

<?php

/**
 * Plugin Name: Disable Sitewide Plugins
 * Author: Shea Bunge
 * Author URI: http://bungeshea.com
 * Version: 0.1
 */

global $blog_id;

if ( in_array( $blog_id, array( 6, 9, 42 ) ) {
    add_filter( 'pre_site_option_active_sitewide_plugins', '__return_empty_array' );
}

Remember to replace array( 6, 9, 42 ) with an array of the blog IDs you want to disable network-wide plugins on.

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.