我想从我的插件菜单中隐藏一些子页面,我的插件菜单代码就像
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");
我想隐藏编辑产品并从我的插件菜单中删除产品页面,如果我保留空菜单标题字段,则显示菜单中的间隙。
你可以告诉我怎么做,或者我应该直接打电话给这些文件答案 0 :(得分:5)
设置为null - 将隐藏菜单链接
add_submenu_page(null, $page_title . " - Delete Products", "Edit Products", $capability, $parent_slug . "-edit-product", "editProduct");