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.
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.
- WordPress for beginners Part II (techietalk.in)
- Firefox 23 Beta arrives, enables mixed content blocking, click-to-start plugins (betanews.com)
- WordPress Database Junk (graphiclineweb.wordpress.com)