Reorders and cleans up the WordPress admin menu.
<?php
/**
* Reorders and cleans up the administration menu to make it more user-friendly.
*
* @param array $menuOrder The current array of menu items.
* @return array An updated order of the items that correspond to the menu.
*
* @link https://codex.wordpress.org/Plugin_API/Filter_Reference/custom_menu_order
*/
function ccd_reorder_admin_menu( $menuOrder ) {
if ( ! $menuOrder ) {
return true;
}
return array(
'index.php',
'separator1',
'edit.php',
'edit.php?post_type=page',
'edit.php?post_type=custom_type',
'separator2',
'upload.php',
'users.php',
'separator3',
'themes.php',
'plugins.php',
'tools.php',
'options-general.php',
'separator-last',
);
}
add_filter( 'custom_menu_order', 'ccd_reorder_admin_menu', 10, 1 );
add_filter( 'menu_order', 'ccd_reorder_admin_menu', 10, 1 );
WordPress Snippet