Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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