Discover in this tutorial how to remove the settings menu of a plugin from the WordPress admin bar using code.
One practice I recommend, as a good fan of minimalism, is to remove all elements of a child theme that you will not be using.
This is especially useful for your customers, as you will reduce the noise and encourage them to have a better view of the settings that really need to be changed.
Following the tutorial on how to hide the menus of some plugins in WordPress sidebar, a subscriber asked me if I could do the same but for the admin bar (at the top).
There are some plugins that also add an element to the admin bar. It’s true that some of them can be hidden from their settings, but others don’t offer this option.
So in this tutorial we are going to see some examples so you can understand how the code works and you can apply it to any plugin.
The result would look something like this:
And here are the instructions:
Snippet to remove a plugin menu from the WordPress admin bar.
First you need to know the name of the menu you want to hide. To find out, go to the web inspector and right click on the item you want to hide.
For example, if we inspect the UpdraftPlus element:
You will see that the item ID is:
To remove this item you will have to use the name that appears after
wp-admin-bar. In this case,
Now with an example you’ll see it much clearer.
Add the following code snippet to your functionality plugin:
With the above code, the WordPress admin bar menu items of these plugins will no longer be displayed:
- Query Monitor
- Gravity Forms
As you can see, in some cases it’s very easy to deduce the ID/name to hide a plugin (like Query Monitor or Gravity Forms), but others are more complicated (like UpdraftPlus). But with the initial trick of inspecting the menu item I just told you about, you will have no problem. 😉
Do you want to remove a particular plugin’s menu from WordPress admin bar? Now you know how.
This is especially useful if you combine it with the user role (using the
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. 😉