wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



remove_submenu_page › WordPress Function

Seit3.1.0
Veraltetn/v
remove_submenu_page ( $menu_slug, $submenu_slug )
Parameter: (2)
  • (string) $menu_slug The slug for the parent menu.
    Erforderlich: Ja
  • (string) $submenu_slug The slug of the submenu.
    Erforderlich: Ja
Gibt zurück:
  • (array|false) The removed submenu on success, false if not found.
Definiert in:
Codex:

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' )


Quellcode

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;
}