How to Hide a Plugin from the Installed Plugins List in WordPress

When is it OK to Hide Plugins?

You probably don’t want to make hiding plugins from users a regular occurrence, however, it can make a lot of sense when trying to provide a curated WordPress experience.

For example, let’s say you’ve created a platform where your clients get a turnkey website that allows their restaurant to start taking online orders. You probably don’t want anyone to be able to deactivate or delete the plugin that provides the foundational functionality for that service. In this scenario, hiding the plugin will effectively hide the UI that would allow a client to disable your plugin.

Hiding plugins is NEVER the type of thing you should do in a publicly released plugin!

How can I hide a plugin?

If you still think that hiding a plugin makes sense for you, then let’s walk through how to make it happen.

First, we want to make sure our code only impacts the installed plugin list in the WordPress admin. Thankfully, WordPress uses the WP_Plugin_List_Table class only in this exact location. Looking at the code, we see that there is an all_plugins filter that we can use to override the listed plugins. The plugin list passed to this filter is an array indexed by plugin basename.

Note: A plugin basename consists of the plugin directory, a forward slash, and then the name of the PHP file containing the plugin headers.

For example, the Hello Dolly plugin basename would be hello-dolly/hello.php. Just be aware that the version of Hello Dolly that ships with WordPress core uses a different basename than if you were to install the plugin from The version in WordPress core is just a single file not located in a directory, so its basename would just be hello.php.

The code below uses the all_plugins filter to unset all instances of Hello Dolly from the plugins list:


	function ( $plugins ) {

		$shouldHide = ! array_key_exists( 'show_all', $_GET );

		if ( $shouldHide ) {

			$hiddenPlugins = [

			foreach ( $hiddenPlugins as $hiddenPlugin ) {
				unset( $plugins[ $hiddenPlugin ] );


		return $plugins;

You’ll notice that I’ve added a $shouldHide variable which will hide all plugins as long as the URL doesn’t have a show_all query parameter. In other words, if you visit, then you will be able to see all plugins. This can be nice if you need to jump in and toggle a plugin on and off to help debug an issue.

To implement this code, you need to create a new must-use plugin, maybe with the name hide-plugins.php, and paste the code above inside of that file. Then, replace the plugin basenames in the $hiddenPlugins array with the plugins you want to hide!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.