How to Disable a Plugin for One Site in Multisite

In this tutorial, I will dive into how you can disable a network activated plugin for one specific site within your WordPress Multisite Network.

First of all, we’re going to talk about plugins that can only be activated for the whole network. Otherwise, let’s say you have the WooCommerce plugin. You can easily disable or enable it for one site if you go to that specific site’s admin dashboard and activate or deactivate the plugin individually.

Let’s take a look at the example.

Let’s say you have 5 sites in your WordPress Multisite network. And you want to disable WooCommerce only for one site, let’s say “Site 3”. Here is a step-by-step:

That’s how you can disable a non-network-wide plugin for one site in a multisite network.

Now, let’s talk about the WordPress plugin that can only be network-activated. If you’re using a plugin like this and you go to any sub-site dashboard, you will notice that it says “network only”. For example, this is my Simple Multisite Crossposting plugin:

WordPress Multisite disable a plugin for one site
As you can see on this screenshot, a plugin like “Advanced Cron Manager” can be easily disabled or enabled for one site, but Simple Multisite Crossposting shows a message “Network Only”.

What can we do in this case?

First of all, let me warn you that if you try to deactivate a plugin like that in the code, then, depending on the plugin, it may cause errors on your website. So, please be careful.

All right, now it is time to use a code snippet like this one:

add_action( 'admin_init', function() {
	
	// A blog ID where we want to deactivate the plugin
	$blog_id = 3;
	$plugin_slug = 'rudr-simple-multisite-crosspost/rudr-simple-multisite-crosspost.php';
	
	if( $blog_id === get_current_blog_id() ) {
		deactivate_plugins( $plugin_slug );
	} else {
		switch_to_blog( $blog_id );
		deactivate_plugins( $plugin_slug );
		restore_current_blog();
	}

} );

That’s it, I recommend you to enable this snippet network-wide if you want to deactivate a specific plugin for just one specific sub-site of your multisite network.

Misha Rudrastyh

Misha Rudrastyh

Hey guys and welcome to my website. For more than 15 years I've been doing my best to share with you some superb WordPress guides and tips for free.

Need some developer help? Contact me

Follow me on X