Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I was looking at the method below to reorder the Admin Menu Sections:

http://wordpress.stackexchange.com/a/1220/1044

...and was wondering if it's possible to reorder the submenu sections using similar method.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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;
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.