The add_menu_page
documentation says to pass the menu title as the second parameter:
add_menu_page('Page Title', 'Menu Title', ...);
When adding more pages later via add_submenu_page
, the main page becomes the first entry in the submenu:
However, I want the first item in the list to have a different name (but still point to the same page), the way WordPress itself does it:
How could I accomplish that in my plugin?
You can make the ‘slug’ for the submenu page equal that of the top level page, and they’ll point to the same place:
E.g.
Make the slug of the parent menu item and sub-menu same (first one item) as below
Hi I just spent forever looking for this and the correct way is not listed here. You want to use
to the end of your function
Simply add this:
For debugging purposes, you can do a
print_r($menu)
to check the whole WP menu.if different name of first sub-menu create same slug of parent and first child and call same function