[wp-hackers] Block Specific Plugins

Stephen Rider wp-hackers at striderweb.com
Thu Apr 30 17:51:17 UTC 2015


IF you really KNOW what plugins you want, you can do this:

add_filter( 'option_active_plugins', ‘filter_get_active_plugins’, 100 );
add_filter( 'transient_active_plugins', ‘filter_get_active_plugins’, 100 );

function filter_get_active_plugins( $data ) {
	$data = array( <plugins you want to allow> );
	sort( $data );
	return $data;
}

This won’t merely **allow** them; it will completely replace the list of active plugins with your list. If one of those plugins are not present, however, you’ll get “not found” errors.

For a whitelist solution of permitted (but not necessarily present) plugins, you’d do a loop and remove anything from $data that’s not on the whitelist.

-- 
Stephen Rider

wp-hackers at striderweb.com
http://striderweb.com/nerdaphernalia



More information about the wp-hackers mailing list