How do I remove the auto-created submenu item below an admin menu.
-
Hi all,
I have written a plugin that adds an admin menu to the Admin interface and a couple of submenus. I used…
add_menu_page(‘MY_MENU_ITEM’,’MY_MENU_ITEM’,’manage_options’,’my-menu-item-slug’,’my_menu_item_func’);
add_submenu_page(‘my-menu-item-slug’,’SubMenu1′,’SubMenu1′,’MyCapability’,’sub-slug-1′,’sub_func_1′);
add_submenu_page(‘my-menu-item-slug’,’SubMenu2′,’SubMenu2′,’MyCapability’,’sub-slug-2′,’sub_func_2′);What I get is a menu that looks like…
MY_MENU_ITEM
|–MY_MENU_ITEM
|–SubMenu1
+–SubMenu2I have tried using the remove_submenu_page() immediately after the add_menu_page() function but the second MY_MENU_ITEM persists.
add_menu_page(‘MY_MENU_ITEM’,’MY_MENU_ITEM’,’manage_options’,’my-menu-item-slug’,’my_menu_item_func’);
remove_submenu_page(‘MY_MENU_ITEM’,’MY_MENU_ITEM’);
add_submenu_page(‘my-menu-item-slug’,’SubMenu1′,’SubMenu1′,’MyCapability’,’sub-slug-1′,’sub_func_1′);
add_submenu_page(‘my-menu-item-slug’,’SubMenu2′,’SubMenu2′,’MyCapability’,’sub-slug-2′,’sub_func_2′);How do I remove the “MY_MENU_ITEM” submenu?
- The topic ‘How do I remove the auto-created submenu item below an admin menu.’ is closed to new replies.