Skip to content

Instantly share code, notes, and snippets.

@robgolbeck
Last active August 29, 2015 14:19
Show Gist options
  • Save robgolbeck/88157cf8c7cae7be114c to your computer and use it in GitHub Desktop.
Save robgolbeck/88157cf8c7cae7be114c to your computer and use it in GitHub Desktop.
Function to change the order of the admin menu items in WordPress.
<?php
// Rearrange the admin menu
// Reference: https://codex.wordpress.org/Plugin_API/Filter_Reference/custom_menu_order
function custom_menu_order($menu_ord) {
if (!$menu_ord) return true;
return array(
'index.php', // Dashboard
'edit.php?post_type=page', // Pages
'edit.php?post_type=YOUR-CUSTOM-POST-TYPE', // Custom Post Type
'edit.php', // Blog Posts
'edit-comments.php', // Comments
'separator1', // First separator
'upload.php', // Media
'link-manager.php', // Links
'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');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment