Wordpress - How to disable a network enabled plugin for just one site?

You can use the filter site_option_*.

E.g. the following will disable akismet on blog with id 2.

add_filter('site_option_active_sitewide_plugins', 'modify_sitewide_plugins');

function modify_sitewide_plugins($value) {
    global $current_blog;

    if( $current_blog->blog_id == 2 ) {
        unset($value['akismet/akismet.php']);
    }

    return $value;
}

This plugin: http://firestats.cc/wiki/WPMUPluginCommander

bypasses the network activation stuff and does its own. and lets you disable the plugin on a site by site basis.

Update: Looks like this plugin breaks the sitewide tags plugin, so be careful before trying on a production network.


Here is what worked for me to disable a plugin for one particular theme on a multisite / multitheme install. I added these few lines at the top of the functions.php file in my theme:

/**
 * Disable fancybox plugin for this theme, it breaks javascript
 */
function deactivate_plugin_conditional() {
    if ( is_plugin_active('fancybox-for-wordpress/fancybox.php') ) {
        deactivate_plugins('fancybox-for-wordpress/fancybox.php');
    }
}
add_action( 'muplugins_loaded', 'deactivate_plugin_conditional' );

Tags:

Multisite