I was looking at the method below to reorder the Admin Menu Sections:
https://wordpress.stackexchange.com/a/1220/1044
...and was wondering if it's possible to reorder the submenu sections using similar method.
I was looking at the method below to reorder the Admin Menu Sections:
https://wordpress.stackexchange.com/a/1220/1044
...and was wondering if it's possible to reorder the submenu sections using similar method.
Yes there is, but I cannot find a simpler way...
Here, we are changing the Media
submenu and inverting Add new
and Library
.
add_filter( 'custom_menu_order', 'wpse_73006_submenu_order' );
function wpse_73006_submenu_order( $menu_ord )
{
global $submenu;
// Enable the next line to inspect the $submenu values
// echo '<pre>'.print_r($submenu,true).'</pre>';
$arr = array();
$arr[] = $submenu['upload.php'][10];
$arr[] = $submenu['upload.php'][5];
$submenu['upload.php'] = $arr;
return $menu_ord;
}