How to Remove Menus From the WordPress Dashboard

How to Remove Menus From the WordPress Dashboard

The WordPress codex is full of fun things that you can experiment with. Have you ever wanted to remove a menu page from the WordPress dashboard to prevent clients getting confused by the settings menu? Blow the dust off of your handy codex and check out the function references for removing menu pages.

Continue reading, or jump ahead using these links:

Removing Items from the Admin Menu Using Code

Here’s what you’re looking for:

<?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?

Posts ... who needs it?

Posts … who needs it?Just for kicks, let’s remove the settings menu, too. Here’s the before and after:

Before and after removing posts and settings menu.
Before and after removing posts and settings menu.

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 (a plugin created for a specific website that acts as a portable functions.php file, which carries across different themes).

Don’t worry it’s very easy. I’ll walk you through it:

First, start with a sample functionality plugin like the one shown below  …

Sample Functionality plugin.

Sample Functionality plugin.Or … open a blank text file and add information about your plugin …

Add your plugin information.

Add your plugin information.Next, add your code:

This will remove every menu for all users\.
This will remove every menu for all users.

Using the above code will remove every menu for all users. To remove only certain menu items include only those you want to hide within the function (and to remove menus for only certain users use current_user_can()).

As we only want to remove the post and settings menu, let’s include only the code for those items …

This will remove the Settings and Posts Menu items.
This will remove the Settings and Posts Menu items.

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 new functionality plugin. You’ll find it among your inactive plugins, ready to activate:

Activate functionality plugin.
Activate functionality plugin.

The ‘Posts’ and ‘Settings’ should now be removed from the WordPress admin menu …

Menu items removed.
Menu items removed.

To restore the missing menu items, just deactivate the plugin…

Deactivate the plugin to restore menu items.

Customizing the Admin Menu Using a Plugin

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

FREE EBOOK
Your step-by-step roadmap to a profitable web dev business. From landing more clients to scaling like crazy.

By downloading this ebook I consent to occasionally receive emails from WPMU DEV.
We keep your email 100% private and do not spam.

FREE EBOOK
Plan, build, and launch your next WP site without a hitch. Our checklist makes the process easy and repeatable.

By downloading this ebook I consent to occasionally receive emails from WPMU DEV.
We keep your email 100% private and do not spam.

For example, if you are running a multi-author site or blog and don’t want to mess with code (or create the functionality plugin described above) but would like to edit a WordPress admin menu, hide the admin menu for specific users, or even add a custom admin menu in your WordPress dashboard, you can customize your WordPress admin menus for users based on their roles and capabilities via a drag and drop interface using the Admin Menu Editor plugin.

To use this plugin, go to ‘Plugins’ > ‘Add New’, then install and activate the plugin from your WordPress dashboard …

Install and activate the Admin Menu Editor plugin.
Install and activate the Admin Menu Editor plugin.

After activating the plugin, go to ‘Settings’ > ‘Menu Editor’ to edit and configure the admin menu interface …

Edit the admin menu interface.
Edit the admin menu interface.

After activating the plugin, drag and drop items in the Menu Editor screen to rearrange the menu layout. Click on top-level menu items to display submenu items. Clicking on individual menu items displays options for that specific menu or submenu item.

Edit your admin menu.

You can play around with different settings and configurations to add, edit, and customize WordPress admin menus to your liking.

Keep the following in mind when using the Admin Menu Editor plugin:

  • Menu permissions are based on capabilities. Select or restrict menu visibility by setting the required user roles and capabilities.
  • To hide a menu item from a specific user role or an individual user, you need to set the “extra capability” field to a capability that the role or user doesn’t have.
  • To hide a menu item from all users, select the item and click on the ‘hide’ icon, then click ‘Save’ to update your settings.
  • To hide a top-level menu, you also need to hide all submenu items. A top-level menu will stay visible as long as it has at least one visible menu item (that’s just how admin menus work in WordPress!)
  • You cannot permanently delete built-in menu items, but you can hide these from users.
  • If you try to delete any of the default menus, they will reappear after saving. This prevents default menus from being deleted.
  • To restore the default WordPress admin menu, click on the ‘Load default menu’ button and resave. If you don’t have access to the plugin settings page, you can easily reset the default menu by entering this URL into your browser (replace yoursite.com with your site’s domain): http://www.yoursite.com/wp-admin/?reset_admin_menu=1

To learn more about using this plugin, visit the plugin page here: Admin Menu Editor

Customizing the WordPress Dashboard Using Branda

One last thing to keep in mind is that if you are looking to completely customize and brand the front and backend of any WordPress site or network, consider installing Branda, our ultimate WordPress branding plugin.

Branda - Ultimate WordPress white label branding plugin!
Branda – Ultimate WordPress white label branding plugin!

Branda provides WordPress white label branding for your login page, dashboard, system emails, footers, menus code, maintenance mode, and coming soon landing pages.

For all the rebranding WordPress can handle, go here to learn more: Branda

We hope you’ve enjoyed this tutorial. 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. And if you truly want to explore customization options for your or your clients’ sites, try the other solutions described above.

Have you tried Branda yet? Share your thoughts and comments below.

Tags:

Martin Aranovitch Martin Aranovitch is a blog editor and writer at WPMU DEV. He has been teaching businesses how to use WordPress effectively almost since the platform began. When he is not writing articles and tutorials, he’s bushwalking in the mountains or playing triangle. Connect with Martin on Facebook and his WordPress client training manual and free content management course websites.