wordpress snippets last updated   : October 6, 2014
we now have 641 snippets

Remove menu items from 3.3 admin bar

wordpress snippet

Adding this snippet to the functions.php of your wordpress theme will remove menu items from the wordpress 3.3 admin bar.

snippet :  PHPcopy
function wps_admin_bar() {
    global $wp_admin_bar;
    $wp_admin_bar->remove_node('wp-logo');
    $wp_admin_bar->remove_node('about');
    $wp_admin_bar->remove_node('wporg');
    $wp_admin_bar->remove_node('documentation');
    $wp_admin_bar->remove_node('support-forums');
    $wp_admin_bar->remove_node('feedback');
    $wp_admin_bar->remove_node('view-site');
}
add_action( 'wp_before_admin_bar_render', 'wps_admin_bar' );

Did you like this post? If so please share it with your friends. Thanks!

  • Surkho Salamov

    Thanks, that is really helpful! 

    • http://wpsnipp.com Kevin Chard

      Cool Surkho glad to help, enjoy the snippet!

    • http://www.facebook.com/zloy.djigit Shamil Abu-Hurairah

      huh

  • Pingback: Remove Menu Items from WordPress 3.3 Admin Bar | ChurchMag()

  • Pingback: Remove Menu Items from WordPress 3.3 Admin Bar | ChurchMag()

  • gmw

    Under the “+ New” menu, I would like to remove the “Post” and “Link” sub-menu items. Is there  a way to do this for the 3.3 Admin bar. The only work-around that I have found is to remove the entire “+ New” by adding

    $wp_admin_bar->remove_menu(‘new-content’);

    to your function. Thanks for sharing!

    • gmw

      I got it! Just added the following to your function:

      $wp_admin_bar->remove_menu(‘new-post’);
      $wp_admin_bar->remove_menu(‘new-link’);

  • Zachary Lysobey

    Hmm, is there somewhere where there is documentation of all the menu items etc…?  It seems like several of those posted in your article do nothing at all (at least on the backend – my front-end admin bars are disabled).  Even with them all uncommented – the admin bar has nearly as much cruft on it as when I started.

    Its nice to get rid of that wordpress logo though ;-)

    • http://wpsnipp.com Kevin Chard

       What is it that you are looking to remove,

  • chetaru

    awesome wordpress tip.. now i can remove unwanted link from wordpress admin section, thanks a lot Kevin…

    • http://wpsnipp.com Kevin Chard

      No problem glad see see you like the wordpress snippets :)

  • http://wpsnipp.com Kevin Chard

    was an older snippet, has been updated now. Please don’t add links to premium plugins within the comments.

  • http://www.facebook.com/smbm.tom Tom Lambie

    Here’s some others to add:

    $wp_admin_bar->remove_menu(‘comments’);$wp_admin_bar->remove_menu(‘new-content’);

    • http://wpsnipp.com Kevin Chard

      Cheers, thanks Tom.

    • http://www.tomlewek.com/ Tom Lewek

      Besides removing the logo, these are exactly the two I was looking for, thanks for this!

  • Paul

    Nice Snippet of code. Can this be done so that it only disappers on certain custom post types?

  • Nick

    Hi,

    Discovered your site today and already loving it and used a few snippets in a wordpress store I am creating for a client. Excellent stuff!!

    I was wondering if you would be able to post up a snippet in the same vein as this one but with removing/disabling menu admin menu items per user role – for example the editor role we would want to remove items from the admin menu.. Would be great if you could help out on this!

  • Nick

    Hi,

    Discovered your site today and already loving it and used a few snippets in a wordpress store I am creating for a client. Excellent stuff!!

    I was wondering if you would be able to post up a snippet in the same vein as this one but with removing/disabling menu admin menu items per user role – for example the editor role we would want to remove items from the admin menu.. Would be great if you could help out on this!

    • http://wpsnipp.com Kevin Chard

      Hi Nick,
      I think you would be looking for something along these lines. I didn’t test this but should work without issue. However you would want to check for other roles so a “switch” may work better than a bunch of if statements.

      global $current_user;
      get_currentuserinfo();
      if (user_can( $current_user, “subscriber”)){
      echo ‘you are subscriber';
      }