Web & Software Developer

Remove Admin Menu Items From WordPress Dashboard

This shows you how to remove WP-admin menu items from your WordPress dashboard.

First decide who you want to remove the menu items for. For all WordPress user Roles? Or just for your ‘Editor’ client? Or remove some menu items from the ‘Editor’ dashboard, and remove a different menu item from the ‘Author’ dashboard? After you decide what you want to remove from whom, then get the removal code for each menu item in Step 2.

Step 1 – Remove For Who?

To remove menu items for everyone, whether Administrator, Editor, Author or Contributor, simply use:

add_action( 'admin_menu', 'isa_remove_menus', 999 ); 
function isa_remove_menus() {

	// INSERT MENU ITEMS TO REMOVE HERE

}

To remove menu items for everyone except the ‘Administrator’ role, use:

/* Remove for all but administrator */
 
if ( ! current_user_can('manage_options') ) {
 
	add_action( 'admin_menu', 'notadmin_remove_menus', 999 ); 
 
} 
function notadmin_remove_menus() {
 
	// INSERT MENU ITEMS TO REMOVE HERE
 
}

To remove menu items only for the ‘Author‘ role and below, but not the ‘Editor’, replace line 3 in the code above with this:

if ( ! current_user_can('delete_others_posts') ) {

Sometimes you may want to remove some menu items for the ‘Editor’ and different menu items for the ‘Author’ role. For example, you may have a custom post type that you want only the ‘Editor’ to use, so you need to remove it only from the ‘Author’ dashboard. Use:

/* First remove for Editor, Author, and Contributor, then remove for Author. */

if ( ! current_user_can('manage_options') ) {
 	add_action( 'admin_menu', 'diff_remove_menus', 999 ); 
} 
function diff_remove_menus() {
             
	// INSERT MENU ITEMS TO REMOVE FOR EDITOR, AUTHOR, AND CONTRIBUTOR HERE
 

	// Now remove only for author and below, but not for Editor
	if ( ! current_user_can('delete_others_posts') ) {

		// INSERT MENU ITEMS TO REMOVE FOR AUTHOR HERE

	}

}

And finally, if you’re as picky as I am, you want to remove different menu items for everyone, including your own ‘Administrator’ dashboard. You want to remove some menu items for everyone, some other menu items for ‘Editor’ and below, and some other menu items for ‘Author’ and below. Use this:

add_action( 'admin_menu', 'isa_remove_menus', 999 ); 
function isa_remove_menus() {
 
	// INSERT MENU ITEMS TO REMOVE FOR EVERYONE
 
    
	/* remove for editor and below, but not administrator */
	if ( ! current_user_can('manage_options') ) {

		// INSERT MENU ITEMS TO REMOVE FOR EDITOR AND BELOW

	}
 
	/* remove only for author and below */
	if ( ! current_user_can('delete_others_posts') ) {
	
		// INSERT MENU ITEMS TO REMOVE FOR AUTOHR AND BELOW

	}
} 

Step 2 – Pick Menu Items To Remove

Now choose which menu items to remove and insert these lines into the codes above. Please notice that the codes above each have a note that looks like this:

// INSERT MENU ITEMS TO REMOVE....

That’s where you’ll insert the lines from this step. Here are some menu item removal codes to choose from. These are only the ones I use most, but others exist.

To remove these top-level menu items, such as Posts, Comments, Tools, Media, Links, and Pages:

remove_menu_page( 'edit.php' );					// Posts
remove_menu_page( 'edit-comments.php' );		// Comments
remove_menu_page('tools.php');					// Tools
remove_menu_page('upload.php');					// Media
remove_menu_page('link-manager.php');			// Links
remove_menu_page('edit.php?post_type=page');	// Pages

Don’t remove the Posts menu item, but remove the Categories sub-menu from under Posts:

remove_submenu_page( 'edit.php', 'edit-tags.php?taxonomy=category' );

Don’t remove Posts, but remove the Tags sub-menu under Posts:

remove_submenu_page( 'edit.php', 'edit-tags.php?taxonomy=post_tag' );

To remove a menu item for a custom post type, replace custom-post-type-name with the name of the custom post type to remove:

remove_menu_page('edit.php?post_type=custom-post-type-name'); 

To remove custom admin pages, such as a page with a URL path like:
'wp-admin/admin.php?page=your_page_slug'

…replace your_page_slug with the slug of your custom admin page:

remove_menu_page( 'your_page_slug' );

Remove WooCommerce Admin Sub-Menu Items

Remove the Product “Tags” menu item from under Products:

remove_submenu_page('edit.php?post_type=product', 'edit-tags.php?taxonomy=product_tag&post_type=product' );

Remove the Product “Categories” menu item from under Products:

	
remove_submenu_page('edit.php?post_type=product', 'edit-tags.php?taxonomy=product_cat&post_type=product' );

Remove the Product “Attributes” menu item from under Products:

remove_submenu_page( 'edit.php?post_type=product', 'product_attributes');

By

We've 16 Responses

    • August 9th, 2012 at 12:04 am

      Correct, that’s true. If you want more security, instead of removing a menu item, you can remove capabilities from the users in question. That will remove access completely, depending on which capabilities you take away. See this.

      avatar
  1. September 14th, 2012 at 4:44 am

    Thanks Isabel,
    In my situation, I am working on a local test site; and I know very little about PHP.
    Do you know if there is a way to simply checkbox a menu item and remove it permanently, or do I need to use the steps above? I am not concerned, at this point, about losing an item, since I am only testing menu names and I don’t want my menu items list to get stacked up with unwanted names.
    Thanks,
    Rob
    PS I am using Anthology WP theme from Themeforest.net

    avatar
    • March 5th, 2013 at 6:41 pm

      Sorry, try wrapping it a function. Be sure to edit line 8.

      // remove menus for everyone EXCEPT a few chosen people
      add_action( 'admin_menu', 'isa_custom_remove_menus', 999 );
       
      function isa_custom_remove_menus() {
       
      	global $current_user;
      	$current_user = wp_get_current_user();
      	$allowed_admins = array(1, 3, 5);// EDIT HERE User IDs of allowed people. Menu will not hide from them
      
      	// remove for everyone (all user roles) EXCEPT those with user ids listed above
      	if ( !in_array($current_user->ID, $allowed_admins) ) {
      	 
      	    // INSERT MENU ITEMS TO REMOVE
      	 
      	}
      } 
      
      avatar
  2. April 25th, 2014 at 4:38 pm

    Hello Isabel,

    Your tips are helping me a lot, but I’m a little doubt want to remove the items from the left navigation menu only registered users as an author! You know I can do this?

    avatar
    • April 28th, 2014 at 10:49 am

      This will remove items for Author, but you have to insert the items to remove after line 5:

      // remove from Author
       if ( ! current_user_can('delete_others_posts') ) {
       	function notadmin_remove_menus() {
       
      		// INSERT MENU ITEMS TO REMOVE HERE
      
       
      	}
      	add_action( 'admin_menu', 'notadmin_remove_menus', 999 );
      }
      
      avatar
  3. March 23rd, 2017 at 8:57 pm

    Hi Isabel, thanks for the code. I’m trying remove like this “wp-admin/admin.php?page=theme_my_login” it’s possible? how do it?

    Thanks 😉

    avatar
  4. October 1st, 2017 at 12:16 pm

    Hi Isabel.
    I’m trying to remove Woocommerce admin submenu items:
    – Product categories
    menu link:

    edit-tags.php?taxonomy=product_cat&post_type=product
    

    – Product tags
    menu link:

    edit-tags.php?taxonomy=product_tag&post_type=product
    

    – Attributes
    menu link:

    edit.php?post_type=product&page=product_attributes
    

    My code:

    remove_submenu_page('edit.php', 'edit-tags.php?taxonomy=product_cat&post_type=product' );
    remove_submenu_page('edit.php', 'edit-tags.php?taxonomy=product_tag&post_type=product' );
    remove_submenu_page('edit.php', 'edit.php?post_type=product&page=product_attributes' );
    

    makes nothing.

    Could you help please?

    Regards.

    avatar
    • October 3rd, 2017 at 11:34 am

      Hi, use this to remove the sub-menu items for Product Categories, Tags, and Attributes from under the Products menu:

      remove_submenu_page('edit.php?post_type=product', 'edit-tags.php?taxonomy=product_cat&post_type=product' );
      remove_submenu_page('edit.php?post_type=product', 'edit-tags.php?taxonomy=product_tag&post_type=product' );
      remove_submenu_page( 'edit.php?post_type=product', 'product_attributes');
      
      avatar

Questions and Comments are Welcome

Your email address will not be published. All comments will be moderated.

Please wrap code in "code" bracket tags like this:

[code]

YOUR CODE HERE 

[/code]