Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[WordPress] Customizing the WordPress Administration Menu (For User Experience)
<?php
add_filter('custom_menu_order', 'acme_reorder_admin_menu', 10, 1);
add_filter('menu_order', 'acme_reorder_admin_menu', 10, 1);
/**
* 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 acme_reorder_admin_menu($menuOrder)
{
if (!$menuOrder) {
return true;
}
return array(
'index.php',
'separator1',
'edit.php?post_type=page',
'edit.php?post_type=acme_homepage',
'edit.php?post_type=acme_about',
'edit.php?post_type=acme_profile',
'separator2',
'upload.php',
'separator3',
'themes.php',
'plugins.php',
'users.php',
'tools.php',
'options-general.php',
'separator-last',
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.