You can also change the menu with the global variables of WordPress for display the menu and submenu.
All first items are in the var $menu
and all suparts are in $submenu
.
Also a small example for change the order of the submenu-items with edit.php
.
Add thius plugin and see the result via debugging. The function fb_cmp
is only the logic for reorder, but you can define you custom order in this function, she is the callback for usort
.
<?php
/**
* Plugin Name: .my Tests
* Plugin URI: http://bueltge.de/
* Description:
* Version: 0.0.1
*/
add_action( 'admin_init', 'fb_get_menu' );
function fb_get_menu() {
global $menu, $submenu;
var_dump( $submenu['edit.php'] );
usort( $submenu['edit.php'], 'fb_cmp' );
echo '<hr>';
var_dump( $submenu['edit.php'] );
}
function fb_cmp( $a, $b ) {
if ($a->value == $b->value)
return 0;
else
return $a->value < $b->value ? 1 : -1; // reverse order
}
As hint the result in a screenshot.