megclaypool
2/7/2020 - 12:03 AM

Reorder the WordPress Admin Sidebar so that Pages appears just below Posts

[Reorder the WordPress Admin Sidebar so that Pages appears just below Posts]

Inspired by Customizing the WordPress Admin: Custom Admin Menus on envato-tuts+

Add the following to one of your php files. I'm putting it in register_custom_types.php right below the close of the radicati_theme_init function.



// Move Pages from below Media to below Posts 
// in the Admin Sidebar Menu
function wptutsplus_change_menu_order($menu_order)
{
  // find the pages item, wherever it is in the menu array 
  $key = array_search('edit.php?post_type=page', $menu_order);

  // remove it from that spot
  array_splice($menu_order, $key, 1);

  // 0 = dashboard
  // 1 = separator
  // 2 = posts
  // So we want pages to appear in spot 3!
  array_splice($menu_order, 3, 0, ['edit.php?post_type=page']);

  return $menu_order;
}
add_filter('custom_menu_order', '__return_true');
add_filter('menu_order', 'wptutsplus_change_menu_order');