Try Tuts+ Premium, Get Cash Back!
Customizing Your WordPress Admin

Customizing Your WordPress Admin

Tutorial Details
  • Program: WordPress
  • Difficulty: Intermediate
  • Estimated Completion Time: Varies
  • Files required to edit: functions.php (Make a backup, just in case!)

The backend of WordPress is one of the better ones out there. However, depending on your needs, the menu can be a little crowded with fluff that you just don’t want or need there.

In this tutorial, I am going to show you how to tame your admin menu. I will show you how to rename menus, reorder the menus, or just plain eliminate them without touching core. Because touching core is bad.


Renaming Menus

At times you may want to rename one of the admin menus. For example, you are running a recipe site, and you are using “Posts” to list recipes rather than for a blog.

To do this, you will need to use the admin_menu action hook. It is used for adding submenus to the admin menu, or other miscellaneous options having to do the with the menu.

Renaming top level menus

First, you need to create a function and then attach it to the action hook inside the functions.php of your theme.

function edit_admin_menus() {
	global $menu;
}
add_action( 'admin_menu', 'edit_admin_menus' );

The WordPress admin menu is actually stored in an array ($menu). So first as you see, edit_admin_menus uses $menu global to get the array. Now you will need to pinpoint the key associated with the menu you want to rename. A list of all menus and submenus will be provided at the end of this tutorial.

Since we wanted to change the “Posts” menu to “Recipes”, we know that we need to target “5″:

function edit_admin_menus() {
	global $menu;
	
	$menu[5][0] = 'Recipes'; // Change Posts to Recipes
}
add_action( 'admin_menu', 'edit_admin_menus' );

Believe it or not, that’s all there is to it. Save functions.php, and refresh the admin page. But now the submenus don’t match the new name.

Renaming Submenus

Renaming submenus is almost the same process, except that you need to add the $submenu global, and you will be targeting the link URI as well. So for example, changing “All Posts” to “All Recipes” would look something like this:

$submenu['edit.php'][5][0] = 'All Recipes';

You can do this for every submenu item. All together, edit_admin_menus would look something like this

function edit_admin_menus() {
	global $menu;
	global $submenu;
	
	$menu[5][0] = 'Recipes'; // Change Posts to Recipes
	$submenu['edit.php'][5][0] = 'All Recipes';
	$submenu['edit.php'][10][0] = 'Add a Recipe';
	$submenu['edit.php'][15][0] = 'Meal Types'; // Rename categories to meal types
	$submenu['edit.php'][16][0] = 'Ingredients'; // Rename tags to ingredients
}
add_action( 'admin_menu', 'edit_admin_menus' );

The posts menu has now been transformed to a recipe menu. This process works for all the menus from the Dashboard to Settings as well as their sub menus.


Changing the Menu Order

Now I am going to show you how to change the order of the menus, including the separators. I usually prefer Media and Links to be more towards the bottom since I don’t use them nearly as much as Pages and Comments.

Ordering the admin menu requires using the menu_order filter. However, the menu_order filter requires that you first activate custom_menu_order. So first, you will want to put this code into your functions.php.

function custom_menu_order($menu_ord) {
	if (!$menu_ord) return true;
	
	return array(
		'index.php', // Dashboard
		'separator1', // First separator
		'edit.php', // Posts
		'upload.php', // Media
		'link-manager.php', // Links
		'edit.php?post_type=page', // Pages
		'edit-comments.php', // Comments
		'separator2', // Second separator
		'themes.php', // Appearance
		'plugins.php', // Plugins
		'users.php', // Users
		'tools.php', // Tools
		'options-general.php', // Settings
		'separator-last', // Last separator
	);
}
add_filter('custom_menu_order', 'custom_menu_order'); // Activate custom_menu_order
add_filter('menu_order', 'custom_menu_order');

The order of the menus is top to bottom, so which ever menu you put at the top of the array, will be the first menu. If you do not put one of the standard menu items in the array, it will simply fall to the end of the list, it will not remove it from the menu.


Removing Menus

You have renamed some menus and you have ordered them how you like. But what if you don’t use pages or the link manager at all? You can just remove them.

Removing top level menus

Removing admin menus is very easy to do. WordPress has a built in function just for removing menus:

remove_menu_page();

All remove_menu_page needs is the slug of the menu you are removing (also at the end of this tutorial).

So, for example, if you wanted to remove the Tools menu, you would use:

remove_menu_page('tools.php');

When removing a menu, you can just reuse the same function you created to rename menus. Here is an example of the function you used at the beginning of this tutorial where you renamed the Posts menu, but now it is also removing the Tools menu as well.

function edit_admin_menus() {
	global $menu;
	global $submenu;
	
	$menu[5][0] = 'Recipes'; // Change Posts to Recipes
	$submenu['edit.php'][5][0] = 'All Recipes';
	$submenu['edit.php'][10][0] = 'Add a Recipe';
	$submenu['edit.php'][15][0] = 'Meal Types'; // Rename categories to meal types
	$submenu['edit.php'][16][0] = 'Ingredients'; // Rename tags to ingredients
	
	remove_menu_page('tools.php'); // Remove the Tools Menu
}
add_action( 'admin_menu', 'edit_admin_menus' );

Removing a submenu

Removing a submenu is just as easy, it uses a very similar function that removing a top level menu does. Here it is hiding the Theme Editor from the Appearance menu:

remove_submenu_page('themes.php','theme-editor.php');

The only difference in the arguments is that you must provide the slug of the submenu’s parent, and then the slug for the submenu itself. In a final example, here is the code hiding the entire Tools menu and the Theme Editor submenu:

function edit_admin_menus() {
	global $menu;
	global $submenu;
	
	$menu[5][0] = 'Recipes'; // Change Posts to Recipes
	$submenu['edit.php'][5][0] = 'All Recipes';
	$submenu['edit.php'][10][0] = 'Add a Recipe';
	$submenu['edit.php'][15][0] = 'Meal Types'; // Rename categories to meal types
	$submenu['edit.php'][16][0] = 'Ingredients'; // Rename tags to ingredients
	
	remove_menu_page('tools.php'); // Remove the Tools menu
	remove_submenu_page('themes.php','theme-editor.php'); // Remove the Theme Editor submenu
}
add_action( 'admin_menu', 'edit_admin_menus' );

In Conclusion

As you can see, doing some basic customization to the backend of WordPress is nice and easy, and even though many might not see what you have done, in the end it can (and will) help you greatly. Organization is never a bad thing. You do it on the front end of your theme, why not do it on the backend too?

This is also great if you are running a site for a client. Hiding menus that they could use to cause potential unintended harm to their site is always a huge plus! In future tutorials I will go over more of the customizations that are possible, from using CSS to change the overall look and feel of the backend, to having the customizations only affect certain users.

As promised, I have included a chart that will give you all of the menus and submenus name, key, and slug.

Note: Want to add some source code? Type <pre><code> before it and </code></pre> after it. Find out more
  • http://lgnetwork.net Ernesto

    Seems excellent, everything I needed, thanks for sharing this information greetings

  • Pingback: Wordpress - Administration - Admin | Pearltrees

  • http://www.totalbounty.com John Pratt

    This is a great resource for wordpress/web developers out there. Thanks for coming up with a great tutorial. I’ve used a couple of these in the past and almost similar to what were stated in here.

  • http://maorchasen.com Maor Chasen

    An interesting tutorial!
    I wonder what happens in the write screens. If you change “Add a Post” to “Add a Recipe” it doesn’t necessarily means that when you click on it the title will say “Add a Recipe” but instead “Add a Post”.

    • http://www.ruturaaj.com Ruturaaj

      Valid point… will check it out. But tell you what… when I changed the “Comments” to “Discussions”, it reflected everywhere wherever there was a word “Comment”. So, it means, whenever there is __() or _e or something similar translation-specific functions are used, your change will reflect the changed word there.

    • Chris Ensell

      This technique under those circumstances is really more of a band-aid for the older WordPress sites out there. For the most part, that was more of an example of how you can change the menus. For an actual situation like a recipe site, custom post types are the way to go hands down, and if you aren’t using the blog, you can use the menu hiding technique I showed.

      But to answer your question, it does not change the post headers, at least not the last time I did that.

  • Neil

    I would like to know how to modify the user section, like adding additional fields, uploading etc.

    The tuts+ premium does a good job in creating new posts types etc but it lacks info on the user section.

    • Chris Ensell

      Already underway. :)

  • Jack

    Thanks for the info. It’s nice to be able to change the layout of the menus. As I’m just learn how to work with wordpress I to these tips out and let you know how it goes.

  • Pingback: Customizing Your WordPress Admin | Shadowtek | Hosting and Design Solutions

  • Pingback: デザインダイアログ - WordPress管理画面の左メニューのキーとスラッグのメモ

  • http://likak.ir عكس بازيگران

    thnx for useful infos
    i enjoy them

  • Pingback: Dries Buytaert’s Software Powers A Million Important Websites — And He Built … | Open Knowledge

  • http://www.xn--danielnuez-09a.com Daniel N

    So useful!

    Do you guys know how to remove/rename Menus & Submenus that are generated by plugins?

    • http://www.facebook.com/seobassist AriEph Slackware

      yeah..
      am waiting for thats too..
      if any plugin to generate menu label, so easy to make client glad…

  • http://www.ombres-et-lumieres.eu Eric

    I have a question: How to make a sub-menu of a sub-menu?

    For example, in the posts menu, I have the “all posts” possibility. Is it possible, at that point, to open a new sub-menu with a list of all the posts?

    I really hate clicking on the “all posts” sub-menu and, after a while, the time needed to reload the page, seeking throughout all the posts the one I’ m looking for. Because, most of the time, it is one of the last I wrote. So, it would be quicker with a sub-menu of the sub-menu.

  • http://www.kardiweb.org/ KardiWeb

    Thank you! :)

  • Pingback: Customizing Your WordPress Admin | Wptuts+ | Links

  • http://bowesales.com Jesse

    I just had someone ask me to remove a menu item. Ha! Great post.
    Thank you so much!!

  • http://webdevelopergeeks.com webdevelopergeeks

    Great work!! Will be able to change many things with this tutorial in my pocket. Thanks a lot!!!

  • http://www.webtemplates-creare.com/ Paul Weston

    Thought this was a great article and one that will be very useful to me as I learn WordPress. I love articles like this because it shows me useful techniques and guides to how I can edit and use WordPress to in the way that I want. There are some really useful and interesting points you have made and I will find all of them a great help but I like the idea of removing menus that I don’t need because as I am learning WordPress this will aid me in concentrating on the areas I need. Great article and I look forward to seeing more from yourself.

  • tim

    Is there a way to add extra separators?

  • Castle

    Nice tutorial, but some items from the menu are missing from your chart.

    For example, how can I rename:

    Appearance – > Header

    To

    Appearance – > Logo

    So far, I couldn’t find any Key value for the Header submenu.

  • Pingback: Linkschleuder vom 25.03.2012 bis zum 30.03.2012 | Cocas Blog

  • Pingback: Host Nine Weekly Round-up: March26-30 | HostNine Company Blog

  • Vijay Chhuttani

    I know this is little off topic.. but i still think i can get help here…!!!

    My question is…

    Can WordPress be used as a multi-seller eCommerce platform with custom seller profiles. Or in other words can an eCommerce WordPress template/theme be customized in a way so that users can create new seller profile (assume it like multiple authors) and then be redirected to a customized admin panel/profile page to add items to sell (assume creating new custom posts).

    If someone is already familiar with any such theme then please refer me to it. And if no such theme exists yet… it can be a great idea to develop one as i have found so many people online struggling to find such platforms with flexibility like WordPress.

    Thanks in advance :)

  • http://freakify.com Ahmad Awais

    Very nice and useful post

  • http://niallm1.com Niall

    Thanks a lot! This would be useful for a client’s site as well; WordPress makes a great CMS with a bit of tweaking.

  • Sam

    What if you want to remove themes.php ? This still can be accessed by clicking ‘Appearance’ menu, a menu which I do not wish to remove.

  • http://digiartes.net Juan

    Hi Chris, my question: if I want to remove menus for editors only, should I use
    current_user_can($editor) and then the function???

    I’m gonna try it out.

    • Atlante

      Did you get this to work?

  • Pingback: Настройка панели администратора WordPress | Wordpresso

  • Pingback: WordPress Community Roundup for the Week Ending March 31 - Charleston WordPress User Group

  • Pingback: Navigationspunkte im WordPress-Backend ausblenden und umbenennen | kulturbanause blog

  • Pingback: The Best WordPress Resources from Around the Web

  • Pingback: Los mejores 35 tutoriales para WordPress marzo del 2012 | El blog de David Chávez s

  • Pingback: Hide WordPress admin menus based on user roles « PixelPress Wiki

  • Vibhuti

    Thanks a lot! But one issued .. add this function remove_menu_page(‘tools.php’); using the comment Approve and Unapprove give the one error.

    Warning: Invalid argument supplied for foreach() in C:\xampplite\htdocs\STD_Blog\wp-admin\includes\plugin.php on line 1286
    1346912600..

  • keha76

    Awesome stuff, but how can I add a custom menu separator?

  • Sarah

    This is great! just what I needed to add menu separators so it doesn’t have duplicates.

    I changed Media to Photos with the edit_admin_menu function since my client will only upload photos, but the page h2 still says “Media Library” I was wondering how to change that to “Photo Library”?

    Thanks!

  • Elvis

    It’s working but when I click on the tab “Services” (Originally called Post) the tittle keep saying Post and everything else like categories, search box and all that is asociate.
    So how can I do to change that?
    Thanks!

  • Pingback: Remove all menu and sub-menu items in admin wordpress « dineshshrivastava

  • Pingback: 10 Things I Hate About WordPress (And How to Fix Them) | feed

  • escort bayan

    bayan escort ve escort bayan escort bayan ara escort bayan istanbul

  • http://www.facebook.com/seobassist AriEph Slackware

    How do I know the key of parameter menu label???
    If They are like ‘theme option’ or some plugin setting,..

  • Pingback: Cambiare i nomi dei menù della sezione admin di WordPress | Appunti WP

  • http://www.facebook.com/mittul.chauhan Mittul Chauhan

    100% must for bookmark ..

    i must say .. this is not like the similar kind of articles like creating a plugin or theme development and etc ..

    but this article has its own value .. small tips but very useful and important too ..

    i also agree with this saying – “You do it on the front end of your theme, why not do it on the backend too? ”

    it is 100% true and i appreciate this tutorial … very useful and very well written..

    thank you so much .. lot of love from india.

  • http://twitter.com/cmwwebfx Ciaran Whelan

    Hi Chris… have BOOKMARKED.. great post, especially love how to rename and rearrange the menu items. What I would like to know is an action or snippet to disable the responsiveness of the admin menu completely so it is always at its full width. I have searched high and low through your site and other sites and not seen anything I can add to my theme’s custom functions.

    I have removed the menu icons from my admin skin design that I made in the last few days, so if it collapses, then I have no icons to know which menu is which.

  • Frank Bültge

    Small hint for the goal to simplify the admin area. You can also use the plugin Adminimize for this jobs. It is easy to simplify the admin area for each role.

  • Pingback: Navigationspunkte im WordPress-Backend ausblenden und umbenennen | kulturbanause® blog

  • http://www.facebook.com/jus.herb Jus Herb

    How do you add a title to the admin menu with a function? not a link just a List item you can use as a title