A WordPress-centric search engine for devs and theme authors



remove_submenu_page ›

Since3.1.0
Deprecatedn/a
remove_submenu_page ( $menu_slug, $submenu_slug )
Parameters: (2)
  • (string) $menu_slug The slug for the parent menu.
    Required: Yes
  • (string) $submenu_slug The slug of the submenu.
    Required: Yes
Returns:
  • (array|bool) The removed submenu on success, false if not found.
Defined at:
Codex:

Remove an admin submenu.



Source

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