Discover in this tutorial how to hide the menu items you want from 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.
In a previous tutorial I already explained you how to remove elements from the WordPress admin sidebar.
You can apply the same strategy to the WordPress admin bar.
And in this tutorial you are going to see some examples so you can learn how the code works and you can adapt it to your needs to remove any element from the admin bar.
Here you go:
Snippet to hide WordPress admin bar menu items.
Add the following code snippet to your functionality plugin:
With this example, the following admin bar menu items will no longer be displayed :
- WordPress Logo
- About WordPress link
- Link to WordPress.org
- Link to Documentation
- Link to Support
- Link to Suggestions
Of course, you can modify the snippet to your liking.
Here are some other elements you can remove:
Just add/replace the lines you’re interested in within the above code snippet.
Simple, isn’t it?
Now you can leave only the elements you consider essential.
Do you want to remove menu items from the 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. 😉