remove_submenu_page

函数


remove_submenu_page ( $menu_slug, $submenu_slug )
参数
  • (string)
    $menu_slug
    The slug for the parent menu.
    Required:
  • (string)
    $submenu_slug
    The slug of the submenu.
    Required:
返回值
  • (array|false) The removed submenu on success, false if not found.
定义位置
  • wp-admin/includes/plugin.php
    , line 1807
引入
3.1.0
弃用

Removes an admin submenu.

Example usage:

– `remove_submenu_page( ‘themes.php’, ‘nav-menus.php’ )`
– `remove_submenu_page( ‘tools.php’, ‘plugin_submenu_slug’ )`
– `remove_submenu_page( ‘plugin_menu_slug’, ‘plugin_submenu_slug’ )`

function remove_submenu_page( $menu_slug, $submenu_slug ) {
	global $submenu;

	if ( ! isset( $submenu[ $menu_slug ] ) ) {
		return false;
	}

	foreach ( $submenu[ $menu_slug ] as $i => $item ) {
		if ( $submenu_slug === $item[2] ) {
			unset( $submenu[ $menu_slug ][ $i ] );
			return $item;
		}
	}

	return false;
}
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。