In a wordpress plugin I’m creating, it’s creating a new top-level admin menu with a sub-menu page. Here’s my code:
add_menu_page('Eastview Custom', 'Eastview Custom', 5,"eastview-custom");
add_submenu_page("eastview-custom","GLS Lunch Orders","GLS Lunch",5,'glsLunch','glsLunch');
So this code creates a new admin menu, “Eastview Custom”. Then it adds two sublinks: “Eastview Custom” and “GLS Lunch”. The problem is that I don’t want “Eastview Custom” as a sublink. I would like the only sublink to be “GLS Lunch”. I can’t figure out how to do this. Thanks for any help!
According to the codex
Which you can see on this page here: http://codex.wordpress.org/Adding_Administration_Menus#Sub-Menus
So according to the Codex you should be able to have something like the following (note that I’ve replaced your user levels parameter with capabilities as they are deprecated, and standardised it all to single quotes);
Now you’d think that this would work based on the Codex – it doesn’t. It won’t display any sub menu items simply because there is only one of them. If you add another item you’ll see that this works, ie;
Hope this helps a bit, shame I couldn’t find the answer to the single list item!
the alternative is you can remove the submenu after create main menu
You can use this function
and use like below