Removing Tabs from the WordPress Admin Menu

While the WordPress back-end offers users a wide array of useful tools and features, I’ve found that most sites rarely end up requiring more than a fraction of them.  As a result, I’ve gotten in the habit of removing unneeded items from the WordPress admin menu in order to de-clutter the interface and make it less overwhelming for my clients that are new to WordPress.

In this post I’ll walk through how you can simplify your admin menu by using two newer core WordPress functions, remove_menu_page and remove_submenu_page.

Removing a tab with remove_menu_page()

Older versions of WordPress required working with some rather less-than-straightforward code in order to remove admin menus, but this is fortunately not the case anymore. In WordPress 3.1 a new core function was added called remove_menu_page(), which allows you remove tabs from the admin menu by simply passing the slug of the menu item.

The follow example illustrates how to remove the Links tab from your admin menu using the new remove_menu_page() function:

Links are one feature that I have NEVER used on any WordPress site I’ve built.  As a result I now include this code in all of my themes by default, and should I ever need to use the Links feature I can simply remove it or comment it out.

Removing Multiple Menu Tabs

No need to stop at just one — we can continue to remove other menu tabs by calling remove_menu_page() repeatedly within our function sb_remove_admin_menus().  The following example is a nice reference function that includes the necessary code to remove ALL default tabs from the admin menu.  You can simply include this in your theme’s functions.php file and then comment out whichever items you want to keep.

/* ——————————————————————–
Remove Unwanted Menu Items from the WordPress Dashboard
– Requires WordPress 3.1+
——————————————————————– */
function sb_remove_admin_menus (){
// Check that the built-in WordPress function remove_menu_page() exists in the current installation
if ( function_exists(‘remove_menu_page’) ) {
/* Remove unwanted menu items by passing their slug to the remove_menu_item() function.
You can comment out the items you want to keep. */
remove_menu_page(‘index.php’); // Dashboard tab
remove_menu_page(‘edit.php’); // Posts
remove_menu_page(‘edit.php?post_type=page’); // Pages
remove_menu_page(‘upload.php’); // Media
remove_menu_page(‘link-manager.php’); // Links
remove_menu_page(‘edit-comments.php’); // Comments
remove_menu_page(‘themes.php’); // Appearance
remove_menu_page(‘plugins.php’); // Plugins
remove_menu_page(‘users.php’); // Users
remove_menu_page(‘tools.php’); // Tools
remove_menu_page(‘options-general.php’); // Settings
// Add our function to the admin_menu action
add_action(‘admin_menu’, ‘sb_remove_admin_menus’);

Removing Sub-Menu Items with remove_submenu_page()

So far we’ve been working with the remove_menu_page() function, which removes tabs or “top-level” items in the admin menu.  In order to remove sub-menu or “child” items from the admin menu, you’ll need to use another core function called remove_submenu_page().

This function works similarly to remove_menu_page(), except you must specify 2 slugs: one for the parent item and one for the sub-menu item you want to remove.

For example, here’s how we’d remove the sub-menu for Widgets, which is located under the Appearance tab:

remove_submenu_page( ‘themes.php’, ‘widgets.php’ );

First we specify the slug for the Appearance tab (themes.php), followed by the slug for the Widgets tab (widgets.php).  And that’s all there is to it!

Note: There can be issues with using remove_menu_page() on tabs that are not included by default in WordPress (tabs created by plugins, themes, etc.).  For removing these from your menu you may want to try the older method.


One thought on “Removing Tabs from the WordPress Admin Menu

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s