remove_submenu_page

Advertisement

Summery Summery

Remove an admin submenu.

Syntax Syntax

remove_submenu_page( string $menu_slug, string $submenu_slug )

Parameters Parameters

$menu_slug

(Required) The slug for the parent menu.

$submenu_slug

(Required) The slug of the submenu.

Return Return

(array|bool) The removed submenu on success, false if not found.

Source Source

File: wp-admin/includes/plugin.php

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

Advertisement

Changelog Changelog

Changelog
Version Description
3.1.0 Introduced.

Advertisement

Leave a Reply