Remove Sub Menu items from WordPress Admin’s Left Side

Sometimes you want to use a custom taxonomy as a way for the client to choose one or a couple of their custom post types as a Highlighted post, or a Hero Project, or a Show on Front Page post. When setting this up, there is really no reason to add terms to the custom taxonomy because it’s usually a “yes” or “no”. So we really don’t need it as a Admin sub menu as it just adds to the clutter.

Let’s remove it.

In this instance we are wanting to remove our custom taxonomy registered to our custom post type of “projects”. But don’t be alarmed when you first throw this in your functions file. you will be looking for the array # to your custom taxonomy.

add_action('admin_menu', 'remove_some_stuff');
function remove_some_stuff() {
    global $submenu;
    unset($submenu['edit.php?post_type=projects'][18]);
    print_r($submenu); exit;
}

Once you find it, in my case it was 18, you can comment out the last line. Like this:

add_action('admin_menu', 'remove_some_stuff');
function remove_some_stuff() {
    global $submenu;
    unset($submenu['edit.php?post_type=projects'][18]);
    //print_r($submenu); exit;
}