During wordpress plugin development, Sometimes we need to remove the submenu with the same name as the mainmenu from sidebar

for example see the image

Web Tools ‹ Navaneeth — WordPress

And in-order to remove the menu which repeats and to look like this

‹ Navi — WordPress

we need to add this code to the plugin file or to the functions.php

add_menu_page('page_title','menu_title','manage_options','menu_slug','function');
add_submenu_page('menu_slug','','','manage_options','menu_slug','function');
add_submenu_page('menu_slug','Submenu','Submenu','manage_options','submenu_slug','function');

Leave a Reply

Your email address will not be published.