We can reorder the WordPress admin sub menus without changing the code in core by using custom_menu_order filter.
Sample code to change the order of Dashboard Sub Menus.Just paste the following code in either plugin files or in the functions.php ( theme file )
add_filter( 'custom_menu_order', 'custom_admin_submenu_order' );
if(!function_exists('custom_admin_submenu_order')){
function custom_admin_submenu_order( $menu_ord )
{
global $submenu;
$arr = array();
/*The values 10 and 0 are the index of the submenus Updates and Home. "index.php" is the array index of the Dashboard menu It can be Fetched by using print_r($submenu) */
$submenu_re_index = array(10,0);
foreach($submenu_re_index as $re_index){
$arr[] = $submenu['index.php'][$re_index];
}
$submenu['index.php'] = $arr;
return $menu_ord;
}
}
We can also remove the sub items by simply not specifying the index of the sub menu.
No comments:
Post a Comment