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?
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:
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:
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
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.
Marko Tanaskovic
Thank you for the info Corey. It’s not unexpected taking into account that this is a really old article, but I’ll have someone look at it and correct it.
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
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?
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
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
joan george
hi hi how you guys doing, want to make love!!!!
a.r.rupom
How can i do this only for non-Admins ???
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
Paul
I only want to get rid of a sub-menu item, how would I do this?
A R Naim
Thanks EWER
It’s working nicely 🙂
MundoCaco
thank you very much! 😀
my admin panel clean and beautiful!
Tom Ewer
Glad to hear it!
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.
kaushal
hi tom!!!
can u help me out to re position the menu order via codes any help will be appreciated
regards
kk
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
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 😀
Chris Hill
I got rid of Cherry options by doing this
function remove_cherry_menu(){
remove_menu_page( ‘options-framework’ );
}
add_action( ‘admin_menu’, remove_cherry_menu’, 99 );
I hope this helps
Tom
Thanks Chris!
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.
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.
Tom Ewer
That’s odd — just including it with the space has worked for me before from memory. Sorry, I can’t help…
chathuranga
Got the same problem myself, and tried what Edward has done. No results. 🙁 appreciate if you could look at it again, Tom.
Jhean Couto
I was having this problems too, but I could solve it. You have to write:
__(‘consumer’,’care’)
Do it and be happy!
Cristian
Thanks!
will
hover over the me u item and you will see the short name
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?
Tom Ewer
I’m not sure — test it and see what happens!
Jhean Couto
write:
__(‘consumer’,’care’)
Do it and be happy!
Jhean Couto
write:
__(‘consumer’,’care’)
Do it and be happy!
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!
Tom Ewer
Surprised you’d want to do that given that it’s quite an important menu option! But I’m pretty sure you just need to follow the above steps and add “Canvas” to the array.
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
Tom Ewer
That is a good suggestion — the only thing I would say is that the other way is simpler in that you don’t need to know what the menu slug is.
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.
Tom Ewer
Thanks for the suggestion Troy – White Label CMS is a great plugin. However, if you’re just looking to remove a few items (like I was), using a lightweight code snippet would be a more efficient option.
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
Tom Ewer
Great minds think alike Steven: http://wpmu.org/wordpress-plugins-usability/