Removing menu pages from the WordPress admin

I often get asked by users how to remove menu pages from the WordPress admin. WordPress actually makes this task extremely easy. In this tutorial, I’ll cover the remove_menu_page() and remove_submenu_page() functions, which were added in WordPress 3.1.

Note that this tutorial only shows you how to remove items from the WordPress administration menu. It does not block access to menu pages via direct URL. It’s great for hiding things, but it should not be used as a way to secure specific admin screens. For that, you’ll need to work with the capability system.


The first thing you need to decide is where you’re putting the code. I’ll assume you’re either dropping this in your theme’s functions.php file or one of your plugin files.

The next step is to create your custom function to remove menus and add it to the admin_menu hook. Use a priority of 999 to make sure your code runs last. Your code should look like the following:

add_action( 'admin_menu', 'my_remove_menus', 999 );

function my_remove_menus() {

	/* Use remove_menu_page() and remove_submenu_page() here. */


#Removing top-level menu pages

To remove top-level menus from the admin, you’ll use the remove_menu_page() function. This function takes in a single parameter of $menu_slug. This is a unique slug that defines the menu.

remove_menu_page( $menu_slug );

Suppose you wanted to remove the “Links” section from the WordPress admin because you simply don’t want to use it. To do this, you need its menu slug, which is link-manager.php. Now, plug it into your setup function, which should look like the following code.

add_action( 'admin_menu', 'my_remove_menus', 999 );

function my_remove_menus() {

	remove_menu_page( 'link-manager.php' );


Pretty simple, right? You just plug in a few lines of code.

#Removing sub-menu pages

Removing sub-menu pages is nearly as simple as removing top-level menu pages. WordPress has you covered with its remove_submenu_page() function. The difference with it is that it takes in two parameters: $parent_slug and $menu_slug.

remove_submenu_page( $parent_slug, $menu_slug );

One of my favorite sub-menu pages to remove for my sites is the theme editor because I never edit themes on a live site. Everything is always coded on a development install in a text editor, so this menu item just takes up valuable space. To remove it, I need the parent menu slug (themes.php) and the theme editor menu slug (theme-editor.php). Then, I just plug the code into my custom function like so:

add_action( 'admin_menu', 'my_remove_menus', 999 );

function my_remove_menus() {

	remove_submenu_page( 'themes.php', 'theme-editor.php' );


#How to find menu page slugs

So you know how to remove menu and sub-menu pages from the admin. Using the functions is easy, but you actually have to know the menu slugs to remove them.

To find a menu page slug, simply click on a menu item in the WordPress admin and look at the address bar in your browser. You should see a value similar to the following.


The menu-slug.php is the unique menu page slug for an admin screen. You’ll use that in conjunction with the functionality you’ve already learned.

Leave a Reply

Your email address will not be published. Required fields are marked *