Discover in this tutorial how to hide some plugins from other users on the plugins page to prevent them from deactivating or deleting them by mistake.
WordPress 6.3 introduced, to the delight of developers, quite a few new features and hooks. One of the new filters,
plugin_list, allows you to control which plugins are displayed on the plugins page list (the one located at yourwebsite.com/wp-admin/plugins.php).
Can you think of any situation where you could use this?
I can, for example, removing from the list plugins that are essential for the operation of the web to other users other than you (or the person in charge of web maintenance).
Surely you have customers who need administrator profile, but you prefer that they do not have access to some options, right?
Well, thanks to this filter you can adjust one of them. Let’s see how.
Snippet that allows you to hide some plugins from the plugins page listing to other users
Add the following code at the end of functions.php or in your functionality plugin:
In this code you use the filter
In this example, the following plugins would no longer be shown:
- Gravity Forms
- Easy Digital Downloads (Pro)
- Restrict Content Pro
- Functions (own functionality plugin)
These are some plugins that may be interesting to hide so that no user can disable or delete them by mistake. The idea is that you adapt it to your needs.
To add new plugins, you only have to respect the name of the plugin folder and the main file. In the example of the functionality plugin itself it is
In Easy Digital Downloads if you are using the pro version it is:
On the other hand if you are using the free version it would be:
You get the idea. 😉
You can also modify the conditional to fit the user ID you want or add more than one.
Note: This does not prevent users from being able to use or modify the excluded plugins settings, it simply removes them from the plugin list and therefore they cannot disable or remove them.
Now you know how to hide some plugins from other users on the plugins page to prevent them from deactivating or deleting them by mistake.
Any questions? Let me know in the comments.
And if you want to give me any suggestion for future tutorials, leave it in the contact form. Advantages of being a subscriber. 😉