wpseek.com
Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.



remove_submenu_page › WordPress Function

Od3.1.0
Przestarzałyn/a
remove_submenu_page ( $menu_slug, $submenu_slug )
Parametry: (2)
  • (string) $menu_slug The slug for the parent menu.
    Wymagane: Tak
  • (string) $submenu_slug The slug of the submenu.
    Wymagane: Tak
Powrót:
  • (array|false) The removed submenu on success, false if not found.
Zdefiniowane na:
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' )


Źródło

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