duskosobic
1/26/2017 - 9:52 AM

Hide Installed Plugins from Dashboard : Users can not deactivate the Plugin. As a WordPress Developer, Sometimes you dont want the user to d

Hide Installed Plugins from Dashboard : Users can not deactivate the Plugin. As a WordPress Developer, Sometimes you dont want the user to deactivate certain plugins which are very essential for the site and the deactivation can also break up the entire site.

In such cases you can either explain the importance of those plugins to your client or to hide “Installed Plugins settings” from the dashboard so that user won’t be able to deactivate it.

Here is a WordPress code snippet which will hide the plugin from “Installed Plugins settings” once the plugin is activated.

<?php

add_filter( 'all_plugins', 'hide_plugins');
function hide_plugins($plugins)
{
		// Hide WordPress SEO by Yoast Plugin
		if(is_plugin_active('wordpress-seo/wp-seo.php')) {
				unset( $plugins['wordpress-seo/wp-seo.php'] );
		}
		// Hide Akismet Plugin
		if(is_plugin_active('akismet/akismet.php')) {
				unset( $plugins['akismet/akismet.php'] );
		}
		return $plugins;
}

?>