Skip to content

Instantly share code, notes, and snippets.

@tommcfarlin
Created April 9, 2018 14:30
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tommcfarlin/7c9b97afea71f65c189f97a708c5a34d to your computer and use it in GitHub Desktop.
Save tommcfarlin/7c9b97afea71f65c189f97a708c5a34d to your computer and use it in GitHub Desktop.
[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