remove_menu_page

Remove a top-level admin menu.

Description

(array|bool) remove_menu_page( (string) $menu_slug ); 

Returns (array|bool)

The removed menu on success, false if not found.

Parameters (1)

0. $menu_slug (string)
The slug of the menu.

Usage

  1. if ( !function_exists( 'remove_menu_page' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/plugin.php'; 
  3.  
  4. // The slug of the menu. 
  5. $menu_slug = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = remove_menu_page($menu_slug); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-admin/includes/plugin.php  
  1. function remove_menu_page( $menu_slug ) { 
  2. global $menu; 
  3.  
  4. foreach ( $menu as $i => $item ) { 
  5. if ( $menu_slug == $item[2] ) { 
  6. unset( $menu[$i] ); 
  7. return $item; 
  8.  
  9. return false;