I'm building a plugin that requires its own set of admin pages. I know how to create the top-level link and how to add sub-menus to it. However, what seems to happen is when I create the top-level link, it also automatically adds a submenu page of the same name if I add another submenu page to it.

I'm simply looking for a way to change the name of my first submenu page so that it is different from the parent name. (i.e. in the admin panel, expanding the "Links" menu shows an "All Links" submenu page. Mine would instead say "Links" on top and then "Links" instead of "All Links")

2 Answers 2


You just have set the name of the $menu_slug exactly the same as the parent slug.

  • Ok, but if I create a top level menu and I'm trying to add submenus to it, WordPress seems to automatically create a new submenu that corresponds to the top level menu name (So there is no submenu to start with, but if I decide to use add_submenu_page and add a new submenu, I get a submenu named the same as the top level and THEN the submenu I just created). Is there somewhere in the add_menu_page() function call where I can specify the name I'd want to give to that automatically created submenu?
    – Chiubaka
    Commented Aug 22, 2011 at 4:10
  • Afai-remember: You have to "play" with the names of the slugs. I don't know exactly at the second, but you have to name both equal (on different args) to not get the double menu entry.
    – kaiser
    Commented Aug 22, 2011 at 4:53
  • Ok, so I'm playing with it-- looking at the documentation for the add_menu_page function: codex.wordpress.org/Function_Reference/add_menu_page. So the parameters of this function: $page_title - changes the title of the title page (equivalent to typing the title in <title></title>); $menu_title - changes the on-screen name text for the menu, but changes both the top-level and the automatically created submenu; $capability - permissions requirement; $menu_slug - unique slug requirement to be used in the page URL; Are you saying I need to do something with add_submenu_page as well?
    – Chiubaka
    Commented Aug 22, 2011 at 18:06
  • Try it with $menu_slug set equal both for parent & child.
    – kaiser
    Commented Aug 22, 2011 at 18:08
  • 2
    Yup, that did it. Thanks a ton! That little thing was reaaaally bothering me.
    – Chiubaka
    Commented Aug 22, 2011 at 18:42

This is how I solved the parent menu item also being listed as a submenu item:

    if(!function_exists('remove_submenu_page')) {
    else {

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.