Plugin Development

Remove Plugins From Plugin Screen

If you are creating a WordPress site for a client you could install a load of useful plugins for them, only for them to go in deactivate the plugin and break the site.

Some of the WordPress plugins can be essential to the working of your website, things like the Akismet plugin, Yoast SEO WordPress plugin or even a commenting system like Disqus. You would never want your users to deactivate any of these plugins as they are essential to the workings of your website.

Here is a WordPress snippet that will allow you to install the plugin and once it is activated it will be removed from the plugin screen so it can not be deactivated. The plugin will still be active and can be used as normal but it means that users can not deactivate these plugins. You can add the following into the theme functions.php file or create a new plugin to handle hiding the WordPress plugins.

add_filter( 'all_plugins', 'hide_plugins');
function 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;
Back to top

Learn how to code with Treehouse

  • Learn projects with access to 1000+ videos
  • Practice live with our Code Challenge Engine
  • Get help in our members-only forums

Start with a 7 day free trial