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.