remove_submenu_page()移除后台管理界面的二级菜单

目录

描述

Remove an admin submenu.

Depending on when this function is called, it may not prevent users from accessing the screen for the removed submenu directly (see ticket #18850). Removing a menu does not replace the need to filter a user's permissions as appropriate.

remove_submenu_page() 描述

用法

<?php remove_submenu_page$menu_slug$submenu_slug ); ?>

remove_submenu_page() 用法

参数

$menu_slug

(string) (必填) The slug for the parent menu

默认值: None

$submenu_slug

(string) (必填) The slug of the submenu

默认值: None

remove_submenu_page() 参数

返回值

(array|boolean) 

The removed submenu on success, false if not found.

remove_submenu_page() 返回值

示例

Removes the Widgets submenu page.

In the above example, the value of $page would have been:

Remove custom post type submenu pages. The secret is in converting the second argument `&` to `&amp;`.

remove_submenu_page() 示例

注意

  • 使用到 global: (array) $submenu
  • In order to remove the theme-editor.php submenu of themes.php (and others) in more recent versions of WordPress, you need to bind to the admin_menu hook with a very high priority (about 110, depending on the submenus to remove). Don't use admin_init as previously stated here, hence it will break wp-admin/admin-ajax.php.

remove_submenu_page() 注意

历史

添加于 版本: 3.1.0

remove_submenu_page() 历史

源文件

remove_submenu_page() 函数的代码位于 /wp-admin/includes/plugin.php.

remove_submenu_page() 源文件

相关