Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
WordPress Plugins
View all Guides

How to Remove Menu Item in WordPress Admin Panel

Last updated on by
Special WordPress Hosting offer for WPBeginner Readers
How to Remove Menu Item in WordPress Admin Panel

Have you ever worked with a client who has a hard time understanding technology? Well, as a consultant, designer, or developer, it is your job to make things easier for them. WordPress admin panel comes with a lot of options in the menu, but you can get rid of them fairly easily if necessary. With one of our clients, we needed to get rid of few menu items, so it is easier for her to understand things. In this article, we will show you how easy it is to remove a menu item in the WordPress Admin Panel.

For WordPress 3.1 or above, just paste the following code in your theme’s functions.php file:

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

In version prior to WordPress 3.1, you would need to paste the following code in your theme’s functions.php file:

function remove_menus () {
global $menu;
	$restricted = array(__('Links'));
	end ($menu);
	while (prev($menu)){
		$value = explode(' ',$menu[key($menu)][0]);
		if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}
add_action('admin_menu', 'remove_menus');

The code above will get rid of the Links option for all users (including administrators). Only two user roles are allowed to see the Link tab (Administrators and Editors). Now if this is for a multi-author site (where there are many editors), and you as an administrator still want access to the Links menu, then you can add parameters to do so.

You would need to utilize the function current_user_can(), and with a simple if statement, you can get rid of the link menu or other items for specific user role.

This is a very handy trick for consultants and developers who work on larger sites.

Additional Sources

Remove Menu Page
Current User Can Function Reference
User Roles and Capabilities Chart

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »


  1. ideadeia says:

    But how about some menu items created by a plugin, with pages like “admin.php?page=wpcf-cf” it’s working fine for wp menu items but I cant get it to work with parametized urls,

    Any clue?

  2. ThatK1dB says:

    Very useful! thanks

  3. Will says:

    The unset global option still works for newer versions of WordPress if you still want to allow direct access; to properly block the page you do need to use remove_menu_page.

  4. Jay says:

    Just a note to update this code, admin_init needs to be changed to admin_menu

  5. gleenk says:

    Thank you, but… how can I add link? and metabox (for example only to insert a custom field somewhere, maybe in footer?)

  6. jose says:

    How can remove Item, that are installed by plugin like, Contact 7, Poll Daddy or others ? Which are their names on the menu ??


    • Editorial Staff says:

      You would have to look at each plugin’s codes individually.

      • kreegahdesign says:

        To find what to add where? I would also like to hide the Contact form 7 and SEO admin pages.

      • Maggan says:

        What line of code would I put in there then? If I wanted to remove Contact form 7 for instance

        • wpbeginner says:

          @Maggan You would have to examine each plugin individually to see what is their menu code.

        • Eric Downs says:

          Did you happen to figure out where to look for this?

        • Vali says:

          in wp-config.php put this code:

          define( ‘WPCF7_ADMIN_READ_CAPABILITY’, ‘manage_options’ );
          define( ‘WPCF7_ADMIN_READ_WRITE_CAPABILITY’, ‘manage_options’ );

  7. Alan says:

    You wouldn’t happen to know how to create username specific “if” conditions for the menus do you?

  8. Alan says:

    I was just looking up how to do this the other day and came across a nice bit of code that will leave the links for admins but remove them for everybody else.

    function remove_menus () {
    global $menu;
    if( (current_user_can(‘install_themes’)) ) { $restricted = array(__()); }
    else { $restricted = array( __(‘Posts’),__(‘Links’), __(‘Pages’), __(‘Tools’), __(‘Users’), __(‘Settings’), __(‘Profile’)); } // hide these for other roles
    end ($menu);
    while (prev($menu)){
    $value = explode(‘ ‘,$menu[key($menu)][0]);
    if(in_array($value[0] != NULL?$value[0]:”” , $restricted)){unset($menu[key($menu)]);}
    add_action(‘admin_menu’, ‘remove_menus’);

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.