Codex

Function Reference/remove menu page

Contents

Description

Remove a top level admin menu.

Please be aware that this would not prevent a user from accessing these screens directly. Removing a menu does not replace the need to filter a user's permissions as appropriate.

Usage

<?php remove_menu_page$menu_slug ?>

Parameters

$menu_slug
(string) (required) The slug of the menu (typically the name of the PHP script for the built in menu items; example: edit-comments.php)
Default: None

Return Values

(array|boolean) 
The removed menu on success, false if not found.

Examples

Removes the Links Manager and Tools menu items:

<?php
	add_action( 'admin_menu', 'my_remove_menu_pages' );

	function my_remove_menu_pages() {
		remove_menu_page('link-manager.php');
		remove_menu_page('tools.php');	
	}
?>

Notes

  • Uses global: (unknown type) $menu
  • To remove submenu items in the admin, use remove_submenu_page. Using remove_menu_page() will not work for submenu items.

Change Log

Since: 3.1.0

Source File

remove_menu_page() is located in /wp-admin/includes/plugin.php.

Related

Administration Menus: add_menu_page(), remove_menu_page(), add_submenu_page(), remove_submenu_page(), add_dashboard_page(), add_posts_page(), add_media_page(), add_links_page(), add_pages_page(), add_comments_page(), add_theme_page(), add_plugins_page(), add_users_page(), add_management_page(), add_options_page()

See also index of Function Reference and index of Template Tags.