WordPress Snippets at WPcustoms

Hide Plugin From Plugin Screen

This is a great snippet for client sites. If you got your own custom plugin and want to prevent disabling your plugin – use this function. (rename the plugin name)


/**
 * Snippet Name: Hide Plugin From Plugin Screen
 * Snippet URL: http://www.wpcustoms.net/snippets/hide-plugin-from-plugin-screen/
 */
 function wpc_hide_plugins($plugins)
{
	// Hide hello dolly plugin
	if(is_plugin_active('hello.php')) {
		unset( $plugins['hello.php'] );
	}

	// Hide disqus plugin
	if(is_plugin_active('disqus-comment-system/disqus.php')) {
		unset( $plugins['disqus-comment-system/disqus.php'] );
	}

	return $plugins;
}
add_filter( 'all_plugins', 'wpc_hide_plugins');