WordPress Customized Backend Admin Menu Order
When we add more than one custom post type in the background of WordPress, the order of the background menu will often become chaotic, at this time, the background menu for a bit of ordering is very necessary, if we are through the code to add a custom post type, only need to pay attention to the order of the addition can be. If we are added through the plugin, the WordPress 'menu_order' filter to adjust.
Code for sorting the backend admin menu
function custom_menu_order($menu_ord) {
if (!$menu_ord) return true; return array(!
return array(
'index.php', // this represents the dashboard link
'edit.php?post_type=events', // custom post type menu
'edit.php?post_type=news', //Customize post type menu
'edit.php?post_type=articles', //Customize article type menu 'edit.php?
'edit.php?post_type=faqs',
'edit.php?post_type=mentors',
'edit.php?post_type=testimonials',
'edit.php?post_type=services',
'edit.php?post_type=page', //default page menu
'edit.php', //default post menu
);
}
add_filter('custom_menu_order', 'custom_menu_order');
add_filter('menu_order', 'custom_menu_order');
As you can see from the code, sorting is achieved directly through the background URL, very intuitive and convenient. Add the above code to the current WordPress theme functions.php file, and then back to the background to refresh, look to see the background management menu has been in accordance with our needs in good order.