Moving the menu items in WP Admin

Posted on 29th January, 2015 Leave a Comment

This was a snippet I grabbed off of tutsplus! I’ve found this super useful when I’ve been creating customer themes to give a menu item a higher priority in regards to it’s use in the theme.

functions.php

/* REORDER MENU ITEMS
 * http://code.tutsplus.com/articles/customizing-your-wordpress-admin--wp-24941
 *************************************************************/
add_filter('custom_menu_order', 'custom_menu_order'); // Activate custom_menu_order
add_filter('menu_order', 'custom_menu_order');
function custom_menu_order($menu_ord) {
	if (!$menu_ord) return true;
	 
	return array(
		'index.php', // Dashboard
		'separator1', // First separator
		'edit.php?post_type=background_slider', // Custom post types moved using post_type=cpt name
		'edit.php', // Posts
		'edit.php?post_type=page', // Pages ls
		'upload.php', // Media
		'link-manager.php', // Links
		'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
	);
}

Leave a Comment

To preserve code added to a comment you can wrap your code in short tags
by using [square brackets]:

  1. PHP use - [php] <?php code here ?> [/php]
  2. CSS use - [css] #code-here {} [/css]
  3. HTML use - [html] <div> code here </div> [/html]
  4. JS use - [js] $(".codeHere") [/js]