When solving this issue ( Change admin language based on user (in single-site) ), I did a function so that the plugin would auto-hide from all users except one (me:).
The flaw is that it only auto-hides when active.
At first, it was a mu-plugin, but I had to enable/disable it manually. It really doesn’t need to run all the time, as it may slow the site (?) or even contain some sensitive manipulation of the site’s language (another question mark).
But mainly the motivation is that I don’t want the client activating/deactivating/deleting this plugin (is for my own use), and don’t want it cluttering her own plugins list.
So, decided to split the functions in two plugins:
- One is a Must-Use used to hide the regular one.
- The other will be activated/deactivated upon necessity and is the one from the above linked issue.
But now I run into another question: how to hide one plugin from the Must-Use listing?
Apparently, there’s no way to remove one plugin from the Must-Use list…
But then, found a filter that does even better:
show_advanced_plugins
will completely hide the sight of the Must-Use plugins.After all, if you’re trying to hide something of this nature, then hide it all…
It’s inside the class
WP_Plugins_List_Table
and takes two arguments: a boolean and the plugin type (mustuse
anddropins
).Check this article for a reference of MU and specially Drop-ins. But, for the sake of the wiki, I’ll post the DI table at the end of this answer.
Update:
–
mu-plugin
updated to multiple users and multiple hide plugins was string now it’s arrayThe Drop-in plugin
For testing this procedure we need one of those. Create a file named
db.php
at the root of your wp-content folder and copy this:The Must-use plugin
Then, this one inside the
mu-plugins
folder, and set the parameters of the class.Reference
by hakre on wordpress
Another use: in a Multisite environment, suppose that we have a site specific plugin. Not a Must Use, but a regular plugin, tailor made for just one site.
It lives on
example.com/wp-content/plugins/my-plugin/my-plugin.php
.We’ll make a Must Use plugin,
/mu-plugins/hide-plugins.php
like: