wpseek.com
A WordPress-centric search engine for devs and theme authors



remove_menu_page › WordPress Function

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

Removes a top-level admin menu.

Example usage: - remove_menu_page( 'tools.php' ) - remove_menu_page( 'plugin_menu_slug' )


Source

function remove_menu_page( $menu_slug ) {
	global $menu;

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

	return false;
}