How to Remove Menus From the WordPress Dashboard

The WordPress codex is full of fun little things that you can experiment with. Have you ever wanted to remove a menu page from the WordPress dashboard? Perhaps you’re building a site for a client who gets confused by the settings menu. Blow the dust off of your handy codex and check out the function references for removing menu pages.

Here’s what you’re looking for:

1
<?php remove_menu_page( $menu_slug ) ?>

Replace the menu slug with the name of the php script for the menu item you want to remove.

Here’s a quick example. Let’s say you want to remove the posts menu. Who needs to write posts?

Just for kicks, let’s remove the settings menu, too. Here’s the before and after:

The quick and dirty way to do this one is to add it to your theme’s functions.php file, but that’s only if you’re feeling like a lazy goose. The best way to add this type of modification is to create a functionality plugin. Don’t worry it’s very easy. Just open a blank text file and add a little information about your plugin and then your code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?php
/*
Plugin Name: Remove Settings and Posts Menu
Description: Just don't want my settings menu anymore and I don't want to write any posts - what's the big deal?
Version: 0.1
License: GPL
Author: Sarah Gooding
Author URI: http://untame.net
*/

    add_action( 'admin_menu', 'my_remove_menu_pages' );

    function my_remove_menu_pages() {
        remove_menu_page('options-general.php');
        remove_menu_page('edit.php');           
    }
?>

Save this as remove-menu.php or whatever you want to name it. Then upload it to wp-content/plugins.

Last step: Don’t forget to activate your little plugin. You’ll find it among your inactive plugins, ready to activate:

That was easy, wasn’t it? Please be advised that this only removes the items from the menu but does not prevent a user from accessing those pages, should he know where they are located. For that you’d be better off using a more comprehensive option that limits users based on roles and capabilities.

Before turning to the plugin repository, you may want to have a little fun exploring the codex. You might find exactly what you need to create your own quick plugin.

Featured Plugin - WordPress Q&A Site Plugin

It's now incredibly easy to start your own Q&A site using nothing more than WordPress - The Q&A plugin simply and brilliantly transforms any site, or page, into a perfect support or Q&A environment.
Find out more

Featured Plugin - WordPress Membership Site Plugin

If you're thinking about starting a paid, or just private, membership site then this is truly the plugin you've been looking for. Easy to use, massively configurable and ready to go out of the box!
Find out more

Featured Plugin - WordPress Ecommerce Shopping Cart Plugin

Out of all the WordPress ecommerce plugins available, MarketPress has got to be the winner - easy to configure, powerful functionality, multiple gateways and more. A simply brilliant plugin!
Find out more

Featured Plugin - WordPress Pop-Up Chat Plugin

No javascript required, no third part chat engine, just fully featured chat right in your own database on your own WP sites - couldn't be easier.
Find out more

Featured Plugin - WordPress Appointments Plugin

Take, set and manage appointments and client bookings without having to leave WordPress. Appointments+ makes it easy.
Find out more

Featured Plugin - WordPress Google Maps Plugin

Simply insert google maps into posts, sidebars and pages - show directions, streetview, provide image overlays and do it all from a simple button and comprehensive widget.
Find out more

Featured Plugin - WordPress Wiki Plugin

To get a wiki up and running you used to need to install Mediawiki and toil away for days configuring it... not any more! This plugin gives you *all* the functionality you want from a wiki, in WordPress!!!
Find out more

Featured Plugin - WordPress Newsletter Plugin

Now there's no need to pay for a third party service to sign up, manage and send beautiful email newsletters to your subscriber base - this plugin has got the lot.
Find out more

Featured Plugin - WordPress Infinite SEO Plugin

Fully integrated with the SEOMoz API, complete with automatic links, sitemaps and SEO optimization of your WordPress setup - this is the only plugin you need to help you rank your site number 1 on Google - nothing else compares.
Find out more

Comments (9)

  1. Does this work only for the main menu items? I edited it for just the Tools / Import item (import.php), and it seemed to have no effect. The menu item was still there and import.php was accessed with it.

  2. Hi,
    This post is very valuable, thank you. I applied it.
    But I have a more question;
    how can I remove contact form7 from dashboard, because it is like this;
    ……com/wp-admin/admin.php?page=wpcf7
    what have I to write to remove_menu_page(‘?????’);
    Thanks for your cooperation.
    Regards

  3. What about a plugin to hide menu options (theme, editor, plugins etc )from clients and limit users based on roles and capabilities.

    Now that would be a great plugin:)

    Maybe included into your white label branding plugin.

Participate