WordPress at Your Fingertips

remove_menu_page() WP 3.1.0

Remove a top-level admin menu item, ex: "Posts", "Media", "Pages".

Removes menu items only visually — that means that you still can visit them by their URL. After removing the menu item you still need to control a user's permissions to access the menu item page.

This function should be called on the admin_menu action hook.

To remove a submenu item, use remove_submenu_page().

No Hooks.


Array|false. The removed menu on success, false if not found.


remove_menu_page( $menu_slug );
$menu_slug(string) (required)
The slug of the menu. It's usually the name of the file that represents the menu: upload.php.


#1 Delete menus

add_action( 'admin_menu', 'remove_menus' );
function remove_menus(){

	remove_menu_page( 'index.php' );                  // Dashboard
	remove_menu_page( 'edit.php' );                   // Posts
	remove_menu_page( 'upload.php' );                 // Media
	remove_menu_page( 'edit.php?post_type=page' );    // Pages
	remove_menu_page( 'edit-comments.php' );          // Comments
	remove_menu_page( 'themes.php' );                 // Appearance 
	remove_menu_page( 'plugins.php' );                // Plugins
	remove_menu_page( 'users.php' );                  // Users
	remove_menu_page( 'tools.php' );                  // Tools
	remove_menu_page( 'options-general.php' );        // Settings



  • Global. Array. $menu


Since 3.1.0 Introduced.

Code of remove_menu_page() WP 5.7.2

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;

From tag: WP minimize (minimise reduce mitigate diminish lessen)

More from tag: Admin menu (admin panel)

No comments
    Log In