how to hide wordpress submenu page

i have want to hide some subpages from my plugin menu, my plugin menu code is like

add_menu_page($page_title, $menu_title, $capability, $parent_slug, "addProduct", Null, 21);
    add_submenu_page($parent_slug, $page_title . " ", "", $capability, $parent_slug, "");
// Product section
    add_submenu_page($parent_slug, $page_title . " - Add Products", "Add Product", $capability, $parent_slug . "-add-product", "addProduct");
    add_submenu_page($parent_slug, $page_title . " - View Products", "View Products", $capability, $parent_slug . "-view-product", "viewProducts");
    add_submenu_page($parent_slug, $page_title . " - Edit Products", "Edit Products", $capability, $parent_slug . "-edit-product", "editProduct");
    add_submenu_page($parent_slug, $page_title . " - Delete Products", "Edit Products", $capability, $parent_slug . "-edit-product", "editProduct");

i want to hide edit products and delete product page from my plugin menu, if i keep empty menu title field it shows gap in menu.

Read More

can you guys tell me how to do it or should i have direct call to these files

Related posts

Leave a Reply

1 comment

  1. Set to null – will hide menu link

    add_submenu_page(null, $page_title . " - Delete Products", "Edit Products", $capability, $parent_slug . "-edit-product", "editProduct");