How to Customize Or Hide the WordPress Admin Toolbar
Since WordPress 3.1, the WordPress Admin Bar, now known as the WordPress Toolbar, has been a part of the WordPress core. If you’re not sure what I’m talking about, it’s that omnipresent bar at the top of your screen whenever you’re logged in to WordPress.
It’s helpful enough, but a bit basic. That simplicity might cause you to want to do one of two things:
- Make it better by adding or removing certain functionality
- Hide it so that it doesn’t get in the way
To accomplish that, I’ll spend this post showing you how to perform a few different tweaks:
- Remove the WordPress Admin Bar using both a plugin and your own code
- Hide specific elements from the WordPress Toolbar with a plugin or your own code
- Add your own links to the WordPress Admin Bar with code (plus a premium plugin that makes it easier)
Note, I’ll use the terms WordPress Admin Bar and WordPress Toolbar interchangeably in this post.
Let’s jump in!
How to Hide the WordPress Admin Bar
One of the most common requests is how to hide or remove the WordPress Toolbar.
As is often the case with WordPress, you can go about this two ways:
- With a plugin
- With your own code
I’ll show you both ways – you can pick the one that you prefer.
But first! If you just want to disable the Toolbar for your own user profile, remember that you can always do this by going to Your Profile in the WordPress dashboard:
Article Continues Below
If you want to disable it for all users, or if you want to disable it while inside the WordPress dashboard, you’ll need to keep reading, though.
How to Remove WordPress Admin Bar With a Plugin
There are a number of plugins that purport to help you do this. But after digging through a bunch of them, the most popular and recently updated seems to be Hide Admin Bar from Shelby DeNike.
There’s nothing to configure with this plugin. Literally, all you do is install and activate it and your Admin Bar is gone. Doesn’t get much easier than that!
If you only want to hide the WordPress Admin Bar for certain user roles, you might be interested in Scott Kingsley Clark’s Admin Bar Disabler plugin.
With this one, you’ll get an actual interface where you can:
- Disable the Admin Bar for everyone
- White list certain user roles
- Black list certain user roles
You can access the interface by going to Settings → Admin Bar Disabler. Then, customize to your heart’s content:
How to Manually Hide WordPress Admin Bar With Code
If you don’t want to use a plugin, you can also easily disable the WordPress Admin Bar with the show_admin_bar() function.
I’ll give you a few different code examples from the Codex.
For all of these examples, you need to add them to:
- A handy plugin like Code Snippets (this is my recommended method)
- The functions.php file of your child theme
- Your own custom plugin
To remove the WordPress Admin Bar for all users, use this:
add_filter('show_admin_bar', '__return_false');
To only show the WordPress Admin Bar for users with administrative privileges, use this:
if ( ! current_user_can( 'manage_options' ) ) {
add_filter('show_admin_bar', '__return_false');
}
That’s it! Nothing too complicated, right?
How to Customize the WordPress Admin Bar
Hiding the WordPress Admin Bar is the nuclear solution. But rather than getting rid of your Admin Bar, why not try to make it more helpful?
In this section, I’ll show you some ways in which you can add (or remove) functionality to the WordPress Admin Bar.
How to Remove and Customize Elements of WordPress Admin Bar
While we’ve reviewed premium plugins like Ultimate Tweaker that let you make changes to your WordPress Admin Bar, you can also accomplish something similar using a free plugin called AG Custom Admin.
AG Custom Admin lets you do things like:
- Change logos
- Modify basic strings
- Hide certain links
Once you install and activate the plugin, you can make changes by going to Tools → AG Custom Admin and selecting the Admin Bar tab:
Then, customize to your heart’s content. The plugin even lets you change the Howdy, name message that appears in the top-right corner of the Admin Bar:
How to Add Links to WordPress Admin Bar
I spent some time trying to find a free plugin that lets you add custom links to the WordPress Admin Bar. But…
I couldn’t actually find anything that did the job. I know that Ultimate Tweaker lets you add custom menus to your Admin Bar, but I couldn’t find any free plugins that did the same.
If you absolutely want this functionality, I recommend just purchasing Ultimate Tweaker for $21.
Otherwise, here’s how to add basic links using code. This code is pulled straight from the WordPress Codex:
add_action( 'admin_bar_menu', 'Toolbar_link_to_mypage', 999 );
function Toolbar_link_to_mypage( $wp_admin_bar ) {
$args = array(
'id' => 'my_page',
'title' => 'My Page',
'href' => 'https://mysite.com/my-page/',
'meta' => array( 'class' => 'my-Toolbar-page' )
);
$wp_admin_bar->add_node( $args );
}
Basically, you need to replace four pieces of information with your own:
- id
- title
- href
- meta
For example, to add a custom link to the WPLift homepage (so that you can easily come here for new tutorials!), you’d set it up like this:
add_action( 'admin_bar_menu', 'Toolbar_link_to_mypage', 999 );
function Toolbar_link_to_mypage( $wp_admin_bar ) {
$args = array(
'id' => 'wplift',
'title' => 'Go to WPLift',
'href' => 'https://wplift.com/',
'meta' => array( 'class' => 'my-wplift-page' )
);
$wp_admin_bar->add_node( $args );
}
Then, you should see your new custom link on the WordPress Admin Bar:
You can also add your own set of menus/submenus using code, but things start getting a little more complicated if you do that.
If you’re feeling brave, you can use this WordPress Codex entry to get started. Or, remember that you can always get the same functionality with Ultimate Tweaker if you’re willing to pay $21.
How to Remove Parts of the WordPress Admin Bar With Code
If you don’t want to use the free AG Custom Admin bar plugin from above, you can also remove parts of the WordPress Admin Bar by using the remove_node() function.
You’ll need to look at the source code of the Admin Bar to find Toolbar node IDs.
Then, you can use some simple code to remove each item. For example, to remove the WordPress logo from the Toolbar, you can use this code snippet:
add_action( 'admin_bar_menu', 'remove_wp_logo', 999 );
function remove_wp_logo( $wp_admin_bar ) {
$wp_admin_bar->remove_node( 'wp-logo' );
}
And just like that, no more WordPress logo:
Wrapping Things Up
Whether you’re one of the people who likes or dislikes the WordPress Admin Bar, I hope you found this post useful!
Remember, you can always:
- Completely hide the WordPress Toolbar
- Remove specific items from the WordPress Toolbar
- Add your own links to the WordPress Toolbar
If you have any questions or know another great Admin Bar tweak, let us know in the comments!