[wp-hackers] WordPress Network and Plugin Availability

Mark Jaquith markjaquith at gmail.com
Wed Feb 9 06:53:15 UTC 2011

On Mon, Feb 7, 2011 at 5:05 PM, SWORD Studios <info at swordstudios.net> wrote:
> Is there a way to give specific sites, options to specific plugins.  I don't
> want all site owners to be able to activate all the plugins installed on the
> server.  For example I want site A to be able to active plugins 1 and 2 and
> for site B to be able to activate plugins 2 and 3 because maybe plugin 1 and
> 3 don't work well together or for countless other reasons.

You can use the all_plugins filter to remove it from the list.

function cws_deny_akismet( $plugins ) {
	if ( !is_super_admin() && isset( $plugins['akismet/akismet.php'] ) )
		unset( $plugins['akismet/akismet.php'] );
	return $plugins;

add_filter( 'all_plugins', 'cws_deny_akismet' );

This doesn't actually deny them from activating it, but without it
present in the UI they won't know the nonce required to activate it.
So it seems effective, at first glance.

And obviously, you can run logic so that the above code is run in a
mu-plugins file and conditionally removes certain plugins from the
list of available plugins, based on which site admin is being

Can anyone find a flaw in this approach? Can you find another way to
activate the plugin?

Mark Jaquith

More information about the wp-hackers mailing list