Is Specific Placement of Top-Level Admin Menu Items Possible? (3 posts)

  1. Pyrmont
    Posted 7 years ago #

    Hi all,

    I'm working on a plugin that adds a top-level menu item to the administrator interface. So far it works fine but my menu item is located at the end of the list of menu items. It would make more sense for this particular menu to inserted above 'Comments' and below 'Pages'.

    Is this possible?

  2. figaro
    Posted 7 years ago #

    I'm not a plugin developer, but if you look in wp-admin/menu.php you will see each menu array has a number, like this for pages: $menu[20]. Comments is: $menu[25]. So, if you make your menu anything between 20 and 25, then it will show between pages and comments. You can test it by changing the number of any existing item...for example, change Appearance from 40 to 21 and you will see it move between pages and comments.

  3. Pyrmont
    Posted 7 years ago #

    Thanks for that, figaro! :) I'm worried that doing it by editing the $menu global is Bad(tm). If that's the only option, though, maybe that's what I've got to do.

Topic Closed

This topic has been closed to new replies.

About this Topic