Wordpress: Custom Admin Submenu Order

It is possible to change the submenu order of the admin menus. In particular we are using the custom_menu_order Wordpress filter to manipulate the global $submenu array. In order to find out the specific submenu identifier we have to display the whole array and choose the necessary entry. For example if we want to adjust the submenu of the plugins menu to display the "Install" link first. We need to move array index [10] to [1]. To avoid displaying the submenu entry as duplicate we also have to remove the old index. Finally we have to sort the array to apply the changes.

The following example and code will sort the "plugins" menu to move the Install link to the top of the submenu. Take it and fit it to your needs to re-order any specific admin submenu:
Array
(
[index.php] => Array ( ... )

[edit.php] => Array ( ... )

[upload.php] => Array ( ... )

[edit.php?post_type=page] => Array ( ... )

[themes.php] => Array ( ... )

[plugins.php] => Array
(
[5] => Array
(
[0] => Installed Plugins
[1] => activate_plugins
[2] => plugins.php
)

[10] => Array
(
[0] => Install
[1] => install_plugins
[2] => plugin-install.php
)

[15] => Array
(
[0] => Editor
[1] => edit_plugins
[2] => plugin-editor.php
)

)

[users.php] => Array ( ... )

[tools.php] => Array ( ... )

[options-general.php] => Array ( ... )

)

/**
* Submenu filter function. Tested with Wordpress 4.1.1
* Sort and order submenu positions to match your custom order.
*
* @author Hendrik Schuster <contact@deviantdev.com>
*/
function order_index_catalog_menu_page( $menu_ord ) {
global $submenu;

// Enable the next line to see all menus and their orders
//echo '<pre>'; print_r( $submenu ); echo '</pre>'; exit();

// Enable the next line to see a specific menu and it's order positions
//echo '<pre>'; print_r( $submenu['plugins.php'] ); echo '</pre>'; exit();

// Sort the menu according to your preferences
$submenu['plugins.php'][1] = $submenu['plugins.php'][10];
unset( $submenu['plugins.php'][10] );
ksort( $submenu['plugins.php'] );

return $menu_ord;
}

// add the filter to wordpress
add_filter( 'custom_menu_order', 'order_menu_page' );