WordPress – Reorder and Rename Admin Menus
Maintaining a clean nav menu on the back end of your WordPress site can be as important as doing so on the front end. If everything is tidy, you know where to go to find things, and edits will ultimately be much easier. One easy way to do this is to simply reorder and rename your WordPress admin area menus. This can be handled with a few simple functions but be aware that not all functions are created equal. Menus generated by plugins can be particularly difficult to rename.
Reordering the default WordPress menus
First let’s start with a basic reordering the default WordPress admin area menus. In the function below I moved the Pages menu before Posts, put the Comments menu directly after Posts. This is a much more logical order since (in most cases) comments are directly related to Posts. I also moved the last two separators (spacers) and placed the Media library between them. To do the same just copy this function into your theme’s functions.php file and modify as you wish. Note: WordPress only gives you three separators so use them wisely.
// Reorder WordPress Admin Menus ------------------------
function wp_custom_menu_order( $menu_ord ) {
if ( !$menu_ord ) return true;
return array(
'index.php', // Dashboard
'separator1', // First separator
'edit.php?post_type=page', // Pages
'edit.php', // Posts
'edit-comments.php', // Comments
'separator2', // Second separator
'upload.php', // Media
'separator-last', // Last separator
'themes.php', // Appearance
'plugins.php', // Plugins
'users.php', // Users
'tools.php', // Tools
'options-general.php', // Settings
);
}
add_filter( 'custom_menu_order', 'wp_custom_menu_order', 10, 1 );
add_filter( 'menu_order', 'wp_custom_menu_order', 10, 1 );
Adding Custom Post Types menus
If you are a developer you likely will have some Custom Post Types in your theme that help segment normal Page content from things such as Products, Services, Team, etc. Below I have given the example of three such Custom Post Types and how to add them to the function above to integrate with your reordering strategy. You will likely notice a pattern in the code. The prefix 'edit.php?post_type=YourCPT', which is followed by the name of the custom post type (CPT) you registered. If you don’t see the name below that you need just use that prefix and add it in. Make sure you include the quotes and commas or your code will throw an error. If you don’t know what the name of your custom post type is, navigate to it in your WordPress admin area and look up at the url in your browsers address bar. You should see that prefix followed by a name.
<?php
// To use copy any of the lines below to the array in the function above
'edit.php?post_type=Products', // Products (custom post type)
'edit.php?post_type=Services', // Services (custom post type)
'edit.php?post_type=Team', // Team (custom post type)
?>
Adding Plugin menus
Now onto the fun stuff. Below are a handful of plugin menus I have identified for use in the function above. Obviously for these to work you need to have the corresponding plugin actually installed. I have everything commented so it should be pretty easy to identify which menu code you need. If you have gotten this far and read everything up to this point you will likely be able to find what you need to add your plugin to the mix even if I haven’t provided the code.
<?php
// To use copy any of the lines below to the array in the function above
'edit.php?post_type=sptp_member', // WP Team Pro (plugin)
'admin.php?page=ocgfsf_integration', // GF Salesforce (plugin)
'gf_edit_forms', // Gravity Forms (plugin)
'edit.php?post_type=tribe_events', // Events Calendar Pro (plugin)
?>
Adding Theme Option menus
Periodically, premium themes like Enfold and Divi will install their own Theme Options menu which you may want to reorder as well. Here are a couple of the common ones.
<?php
// To use copy any of the lines below to the array in the function above
'avia', // Enfold (theme options menu)
?>

Leave a Reply
Want to join the discussion?Feel free to contribute!