I installed a plugin for my users in WPMU and I want to make it appear at the end of the admin menu ....

I tried this but the menu never appears at the end:

function custom_menu_order($menu_ord) {  
if (!$menu_ord) return true;  

return array(  
    'index.php', // Dashboard  
    'edit.php', // Posts 
    'upload.php', // Media
    'options-general.php', // Settings  
 => 'admin.php?page=support', // my plugin

add_filter('custom_menu_order', 'custom_menu_order'); // Activate custom_menu_order  
add_filter('menu_order', 'custom_menu_order');

my plugin menu is "admin.php?page=support"

  • You are not revealing how your plugin menu item is being inserted, and that's what Johannes is talking about. Yes, it is possible to manipulate the menu order, but those hooks you are using doesn't seem adequate and are not being used correctly.
    – brasofilo
    Apr 7, 2013 at 0:32

2 Answers 2


The global variable $menu can be manipulated. Here, we are moving the Pages menu item to the end:

moved pages to the end of the menu

Maybe there's a simpler method to do the recursive array search, I've grabbed an example from PHP Manual. The value to be searched has to be inspected inside the $menu var, enable the debug lines to brute force inspect it.

add_action( 'admin_menu', 'move_menu_item_wpse_94808', 999 );

function move_menu_item_wpse_94808() 
    global $menu;

    // Inspect the $menu variable:
    // echo '<pre>' . print_r( $menu, true ) . '</pre>';
    // die();

    // Pinpoint menu item
    $move = recursive_array_search_php_91365( 'edit.php?post_type=page', $menu );

    // Validate
    if( !$move )

    // Store menu item
    $new = $menu[ $move ];

    // Remove menu item, and add previously stored at the end
    unset( $menu[ $move ] );
    $menu[] = $new;

// http://www.php.net/manual/en/function.array-search.php#91365
function recursive_array_search_php_91365( $needle, $haystack ) 
    foreach( $haystack as $key => $value ) 
        $current_key = $key;
            $needle === $value 
            OR ( 
                is_array( $value )
                && recursive_array_search_php_91365( $needle, $value ) !== false 
            return $current_key;
    return false;
  • What plugin is this? Try to change the priority to a greater number: add_action( 'admin_menu', 'callback', 9999 );
    – brasofilo
    Apr 8, 2013 at 11:30
  • is a plugin to provide user support ....I contacted the seller several times but does not respond. Apr 8, 2013 at 13:34

Are you using add_menu_page?
If so: Its last parameter is the menu position, setting this to a huge number should ensure it's always at the end.

  • thanks for the reply ,my plugin is already in the admin menu ... ...but not at the end... Apr 6, 2013 at 21:24
  • Please clarify: which function are you using to create your plugin's admin menu page? Apr 7, 2013 at 12:20
  • Aha! I thought you were talking about a plugin you had written, hence my question. In that case, you could try the Admin Menu Editor plugin, I've never used it but looks like it might do what you need. Apr 7, 2013 at 16:37
  • I used that plugin for years...and this time it didn't solve my problem . Thanks anyway for the help Apr 7, 2013 at 17:22
  • @Ghinnersmee, the snapshot and "I didn't create this plugin" should be part of the Question.
    – brasofilo
    Apr 7, 2013 at 22:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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