Protect your sites from hackers and boost performance with Sucuri’s Junior Dev Security Bundle — now $500 off.
How to Remove Unwanted Items from the WordPress Admin Sidebar

How to Remove Unwanted Items from the WordPress Admin Sidebar

How to Remove Unwanted Items from the WordPress Admin Sidebar
Cleaning up your WordPress Dashboard needn’t be like pulling teeth.

With most pieces of software, if you don’t like a particular feature, you’re stuck with it. You weigh up the overall pros and cons, and decide if the sacrifices are worth the gains.

That is not the case with WordPress. If you don’t like something, you can change it. If you think something is missing, you can add it. For every “things we’d like to see WordPress do” post, there is a “things we can make WordPress do” post.

And you don’t even need to be a programmer to make these changes or additions. Often, someone else has already done the legwork and released the desired functionality as a plugin. Or perhaps it has been released as a code snippet that you can easily copy and paste into your theme’s functions.php file.

Today we are featuring one such snippet that can make navigating your WordPress Dashboard a lot easier.

Taming the WordPress Admin Sidebar

The WordPress admin sidebar is packed with options. Too many, one might be inclined to say. After all, when was the last time you used the Links feature?

WordPress Links
That’s this button, in case you had forgotten it existed.

What if you don’t have comments on your site, or don’t even use WordPress as a blog? What use are the Posts and Comments sections to you? All of these options are cluttering up your sidebar, and if you are working with clients, are points of potential confusion.

Fortunately, there is a way to get rid of these unwanted menu items, courtesy of CAM Web Design. In their post on simplifying the WordPress admin sidebar navigation, they revealed a simple code snippet that empowers you with the ability to change the landscape of your admin sidebar:

Remove WordPress Admin Menu Items

Download the code snippet here.

You can check out the original post to gain a better understanding of what is happening within the code, but for practical purposes, the only line we need to worry about is this one:

$remove_menu_items = array(__('Links'));

As you can probably guess, __('Links') refers to the “Links” admin menu item. All of the menu items are sensibly named:

  • Appearance
  • Comments
  • Links
  • Media
  • Pages
  • Plugins
  • Posts
  • Settings
  • Tools
  • Users

In order to remove a menu item, just add it to the $remove_menu_items array in the following format: __('menu-item-name').

Let’s look at an example. Say you wanted to use WordPress as a pure CMS and had no interest in its blogging features. The Comments, Links and Posts menu items are all of no use. Your $remove_menu_items array would look like this:

$remove_menu_items = array(__('Comments'),__('Links'),__('Posts'));

Simple, right?

This code snippet has been especially useful for me, as my blog’s theme (Canvas by WooThemes) adds a selection of admin menu items that I have never used. Here’s a before and after shot of my blog’s admin sidebar:

Leaving Work Behind Before & After

A huge improvement. As far as I can tell, the names of the menu items correspond directly with the names you should use in the $remove_menu_items array. So for me to achieve the above result, I included the following in my code snippet:

$remove_menu_items = array(__('Links'),__('Portfolio'),__('Slides'),__('Feedback'));

That’s it! Just a quick and easy way of making your WordPress Dashboard a little more navigable.

Creative Commons photo courtesy of mattlemmon

Tom Ewer Avatar

38 responses

  1. Graphics Cove Avatar
    Graphics Cove

    I started using this before finding this article but it’s a great article to let people know they can hide WordPress menus! I hate how I have a bunch of plugins that create a crazy number of menus in all sorts of places making the wordpress admin area look very messy to myself and to my clients. If only there was a set standard for where plugin developers should put their plugin menus!

    – Steven Noble
    Graphics Cove

  2. Troy Avatar
    Troy

    White label CMS allows you to do this very quickly and easily and allows you to choose a set of menus for those with and without blogs so you can hide comments, links and posts in one click.

    http://wordpress.org/extend/plugins/white-label-cms/

    Keep up the great work at MangeWP.

    Cheers.

  3. bungeshea Avatar
    bungeshea

    You can also use the (much simpler) remove_menu_page() function.

    To remove Links menu:
    remove_menu_page( 'link-manager.php' );

    You need to pass the menu slug as the parameter.

    http://codex.wordpress.org/Function_Reference/remove_menu_page

  4. Mark Wasyl Avatar
    Mark Wasyl

    Thanks for the great info on hiding some of the WooThemes menu items!

    Is there a way to hide “Canvas” from the menu? I can’t seem to figure that one out.

    Thanks again!

  5. Jonathan Lindahl Avatar
    Jonathan Lindahl

    Great post!

    But how should I write it, if I want to remove an item with two words? I would for example like to remove the “Navigation Page”, but how should I write that?

  6. Edward Avatar
    Edward

    Any idea what to do when there is a space in the menu label? I’m trying to hide a menu labeled “Consumer Care”. I’ve tried:

    __(‘Consumer Care’)
    __(‘Consumer_Care’)
    __(‘Consumer-Care’)
    __(‘consumer care’)
    __(‘consumer-care’)
    __(‘consumer_care’)

    None of these seem to do the trick.

  7. Nebulas Website Design Braintree Avatar
    Nebulas Website Design Braintree

    Great post thanks looked for lots of plugins that do this but none work as well. It’s always better to hard code this type of thing is possible anyway.

  8. Atsawin Avatar
    Atsawin

    Anyway to remove the ‘Cherry Options’ menu item that is added by the ‘Cherry Framework’ ?

    It is added by a theme and has a graphic icon before it, in Firebug it looks like other menu items but…

    __(‘Cherry’,’Options’)

    does not work.

    Also how would I find out the slug for this menu item?

    Thanks and great post if I can get this to work 😀

  9. kaushal Avatar
    kaushal

    hi tom!!!!
    can u help me out for repositioning of the side bar menu viz codes i dont wanna add a plugin for it!!!any help or idea will be of great help

    regards

    kk

  10. kaushal Avatar
    kaushal

    hi tom!!!
    can u help me out to re position the menu order via codes any help will be appreciated

    regards

    kk

  11. Henry Avatar
    Henry

    Hello,
    How I can achieve the above but for specific users? For instance instead of making global changes, I want the admins to continue to see Post, Media, etc.

  12. MundoCaco Avatar
    MundoCaco

    thank you very much! 😀
    my admin panel clean and beautiful!

  13. A R Naim Avatar
    A R Naim

    Thanks EWER
    It’s working nicely 🙂

  14. Paul Avatar
    Paul

    I only want to get rid of a sub-menu item, how would I do this?

  15. Arindo Duque Avatar
    Arindo Duque

    I was having the same issue. That led me to develop a custom plugin that solves just that, with an very simple UI. Check it out: http://codecanyon.net/item/wp-admin-menu-manager/9520160?ref=732

  16. a.r.rupom Avatar
    a.r.rupom

    How can i do this only for non-Admins ???

  17. joan george Avatar
    joan george

    hi hi how you guys doing, want to make love!!!!

  18. Aloysius Dalli Avatar
    Aloysius Dalli

    How can I remove the WordPress Advertisement that is on my Large Image that reads “Beauty at its best”

    I thank you in advance

    Dalli

  19. will Avatar
    will

    Hi Tim, Great posts here, thanks.

    Listen, in the sub menu items under the “Add +” at the top of my Dashboard (I was successful at removing them from the sidebar!) the unwanted links are there. Do I follow the same protocol in a different file somewhere? I admit freely I am not a programmer, but I can follow good directions like yours well. Please help.

    Best,
    Will

  20. allen Avatar
    allen

    I have installed the flatsome theme and it created a menu in the admin panel dashboard. How would I know what page would I remove to hide it? when I hover over the menu it has a URL of admin.php?page=flatsome-panel?

  21. Tony Avatar
    Tony

    Hi Tom,

    I read your article on removing Items from the WordPress side bar. Very good.

    I actually need to go in the opposite direction and add items back to the side bar. How would I reset it back to the default?

    Thanks for your help in advance 🙂

    Tony

  22. Corey Avatar
    Corey

    There’s a bug in the code snippet shared here. The original page is a dead-end now, six years later, too.

    Because you call end( $menu ) and then while( prev( $menu ) ), the last item on the menu will never be checked against the list of items to remove.

Leave a Reply

Your email address will not be published. Required fields are marked *