Toolonomy Logo

How to Hide Plugins from WordPress Dashboard with Code?

In this article, I am going to share with you a step-by-step process to hide any plugin you want from the WordPress Dashboard using Function PHP code.
Mohammed Wasim Akram
Blog Post Author
Last Updated: March 21, 2022
Blogpost Type:
0 Shares

If you provide web design services to clients and use WordPress to build those sites, then in some cases you might want to hide some particular plugins from the WordPress plugin page so that your clients couldn't see or touch those plugins.

I do this for those plugins that are crucial and messing with them could potentially break the site or stop some important functionalities from working.

However, your reason to hide the plugins can be different from mine but in this article, I am going to share with you a step-by-step process to hide any plugins you want from the WordPress plugin page using Function PHP code.

So let's get started!

Grab The Plugin Directory Name

The very first thing is that you have to grab the plugin directory name of the plugin you want to hide.

You can find that under the WordPress Dashboard, then head over to the Plugins Admin Menu, and then click on the Plugin Editor sub-menu.

On this page, you need to find and select the plugin you want to hide, which you can see under the Select plugin to edit: dropdown option.

So, in this case, suppose you want to hide the Code Snippets plugin, therefore, you will select the Code Snippets from the dropdown option.

The directory name of the Code Snippets Plugin should look like this: code-snippets/code-snippets.php, which you can see at the top of that page.

The navigation should look like this:

> WordPress Dashboard
> Plugin Admin Menu
> Plugin Editor sub-menu
> Plugin to edit: dropdown
> Select The Plugin (e.g. Code Snippets)
> Copy the directory name (e.g. code-snippets/code-snippets.php)

Edit The PHP Code Block Provided Below

Now you just need to edit and replace the plugin-directory-name/plugin-directory-name.php texts with the actual plugin directory name such as code-snippets/code-snippets.php.

Note: The code block below is editable.

/* Hide Code Snippets Plugin from The Plugin Page */

add_filter( 'all_plugins', 'hide_plugins');
function hide_plugins($plugins)
{
  		// Hide Your Plugin Name
	if(is_plugin_active('plugin-directory-name/plugin-directory-name.php')) {
		unset( $plugins['plugin-directory-name/plugin-directory-name.php'] );
	}

	return $plugins;
}

Install Code Snippets Plugin (Free)

Now install and activate the Code Snippets plugin from the WordPress Plugin Directory and activate it on your site.

If you're a new WordPress user and not sure how to install a plugin on your WP website, then read this article to learn the step-by-step process of installing a plugin on WordPress.

Implement The Code Using Code Snippets Plugin

As soon as you activate the plugin, the next option would be heading over to the Code Snippets admin menu. After that, find the Add Snippet sub-menu and click on it.

The next step is to add the name of your liking to the new code snippet, then paste the copied code block to the code section and select Only run on-site front-end from the radio buttons.

Also, you can add a description for this code in the description section, which is a rich-text editor, and add tags in the tag section to keep things organized for future reference.

After that hit the Save Changes and Active button, and you are good to go. Now you can go to the plugin page, and you won't find the plugin (in this case Code Snippets) you have hidden using the above code.

The navigation should look like this:

> Code Snippets admin menu
> Add Snippet sub-menu
> Add a name for the new code snippet
> Paste the copied code block into the code section
> Select Only run on-site front-end from the radio buttons
> Add a description in the description section
> Add tags in the tag section
> Save Changes and Active

How to Hide Multiple WordPress Plugins from the Plugin Page

Now you already know how to hide a plugin from the WordPress plugin page, but you might be thinking how can you hide multiple plugins at a time?

Don't worry! The process of hiding multiple plugins is way simpler than you think; you don't have to add different snippets for every single plugin you want to hide, which obviously you can do if you want.

But here is what I would recommend: just follow the same steps as I explained above to hide a plugin, and then for the next plugin you just copy the below-mentioned lines from the code then replace the plugin directory name after that paste it just below the same line of code you just copied and repeat the process for the next plugin and on.

	// Hide Your Plugin Name
	if(is_plugin_active('plugin-directory-name/plugin-directory-name.php')) {
		unset( $plugins['plugin-directory-name/plugin-directory-name.php'] );
	}

If you are still confused with whatever I have been saying, then check out the below code, and you will understand everything very clearly:

/* Hide Selected Plugins from The Plugin Page */

add_filter( 'all_plugins', 'hide_plugins');
function hide_plugins($plugins)
{
  		// Hide Your Plugin One
	if(is_plugin_active('plugin-one-directory-name/plugin-one-directory-name.php')) {
		unset( $plugins['plugin-one-directory-name/plugin-one-directory-name.php'] );
	}
  
   		// Hide Your Plugin Two
	if(is_plugin_active('plugin-two-directory-name/plugin-two-directory-name.php')) {
		unset( $plugins['plugin-two-directory-name/plugin-two-directory-name.php'] );
	}
  
   		// Hide Your Plugin Three
	if(is_plugin_active('plugin-three-directory-name/plugin-three-directory-name.php')) {
		unset( $plugins['plugin-three-directory-name/plugin-three-directory-name.php'] );
	}

	return $plugins;
}

Conclusion

In this article, I have explained how you can hide any WordPress plugin you want from the plugin page with the help of the Function PHP code block.

I hope this article is very helpful in solving a really crucial problem for webmasters like you. If you think this tutorial is important for you, then I suggest you bookmark this page for future reference.

0 Shares
Toolonomy Online Community Image
Join Toolonomy Community
Toolonomy Community is a dedicated place to explore the Discussion, Content, Deals & Hidden Details about the Business Development Tools that have the potential to help you succeed in your journey to Digital Entrepreneurship by letting you build, manage, and grow your Business Online with ease.
Free Membership
A Google & HubSpot Certified Digital Marketing Specialist, Self-Taught WordPress Expert, Useful BizDev (Business Development) Tools & Deals Explorer, and the Founder of SyncWin & Toolonomy.
Subscribe
Notify of
guest
2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Andrew
Andrew
4 months ago

Hello,

Thank you for this code. It works when I check Only run in the administration area.
How to hide plugins only for administrators and others but not for superadmin ?

Regards,
Andrew

Related Blog Posts
Explore all the other related blog posts.
WordPress
Recoda Workspace Review: The Steroid for Oxygen Builder
Unleash the true power of Oxygen Builder with Recoda Workspace! Delve into our comprehensive review to unveil the ways this powerhouse transforms your WordPress site development journey. Elevate your website-buildi...
WordPress
How to Restore a Missing Header on WordPress Websites?
Get your disappeared WordPress header or footer back in no time with our step-by-step tutorial. Learn how to fix the vanished header or footer by restoring the missing theme PHP file with ease. Click now to bring y...
WordPress
Yabe Webfont Review: Best No-Code WordPress Font Manager
Discover the Yabe Webfont plugin to effortlessly manage fonts on your WordPress site with this game-changing plugin and enhance the website appearance without any coding skills. Seamlessly integrate with WordPress ...
Explore Blog

Become a Toolonomy Community Member for Free!

Consider joining our Official Community Group if you want to get access to exclusive insider content and information about Exclusive Digital Tools and Technologies. Also, you will be able to get involved in interesting group discussions with like-minded people that are interested in similar topics as you.
Become a Member
Toolonomy Logo
Made with ❤ by & for Digital Tool Enthusiasts
Copyright © 2018 - 2024 by SyncWin | All Rights Reserved.
Top crossmenu
0 Shares
Copy link