Ever since the introduction of the WordPress Admin Bar, there has been a series of hacks for it. One of the more popular snippets I’ve seen, is for its complete removal. Although, I’m not entirely sure why, as you have full control over the Admin Bar in your user settings.
This Admin Bar snippet, however, I find a bit more useful, as the WordPress 3.3 Admin Bar can get a little crowded. Especially if you site has a very long title or you’re running plugins that embed themselves on to the Admin Bar.
Here’s a snippet of code to remove specific menu items from your Admin Bar, without removing it entirely:
Remove WordPress 3.3 Admin Bar Menu Items
You can add this to your theme’s functions.php or drop it into your functionality plugin:
[cc lang=”php”]function wps_admin_bar() {
global $wp_admin_bar;
$wp_admin_bar->remove_menu(‘wp-logo’);
$wp_admin_bar->remove_menu(‘about’);
$wp_admin_bar->remove_menu(‘wporg’);
$wp_admin_bar->remove_menu(‘documentation’);
$wp_admin_bar->remove_menu(‘support-forums’);
$wp_admin_bar->remove_menu(‘feedback’);
$wp_admin_bar->remove_menu(‘view-site’);
}
add_action( ‘wp_before_admin_bar_render’, ‘wps_admin_bar’ );[/cc]
Remove what you want, and I’m sure if you dug a little deeper and played with it some, you can even remove any plugins that have automatically been added to your Admin Bar.
[via WordPress Code Snippets]
Paul Thomson says
Sort ‘n sweet, just what I needed… thanks Eric!
Thanks,
Paul 🙂
Eric Dye says
You, Sir, are very welcome. 🙂
PRAVEEN KUMAR says
Hi, I am using avada theme in wordpress, after loging there is one options “Theme Options” showing on Admin bar. I want to remove this menu item, i have used this way but not getting result.
function wps_admin_bar() {
global $wp_admin_bar,
$wp_admin_bar->remove_menu(‘smof_options’);
}
add_action( ‘wp_before_admin_bar_render’, ‘wps_admin_bar’ );
Can you help me to sort out this issue? others are working fine this way. thanks for this article.
Thanks:
PK
Eric Dye says
Is this a premium theme?
Andy says
Yes, it is a premium theme.. I am having the same issue on a client’s site.. for some reason calling the items ID isnt removing it from the toolbar…
Eric Dye says
It looks like this has been deprecated. :-/