7 days of WordPress plugins, themes & templates - for free!* Unlimited asset downloads! Start 7-Day Free Trial
  1. Code
  2. Creative Coding

Customizing Your WordPress Admin

Read Time: 6 mins

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.

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":

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:

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

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.

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:

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:

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.

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:

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:

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.

Did you find this post useful?
Want a weekly email summary?
Subscribe below and we’ll send you a weekly email summary of all new Code tutorials. Never miss out on learning about the next big thing.
Scroll to top
Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.