Remove Categories / Tags From Admin Menu

I want to remove or hide Categories / Tags submenu under Posts in the Admin Menu. I know this works with the themes submenus:

remove_submenu_page( 'themes.php', 'widgets.php' );

The same doesn’t seem to work for posts unfortunately:

remove_submenu_page( 'edit.php', 'edit-tags.php' );

I’m using the admin_menu action: add_action( 'admin_menu', 'function_call' )

Do I need to add something else?

5

add_action('admin_menu', 'my_remove_sub_menus');

function my_remove_sub_menus() {
    remove_submenu_page('edit.php', 'edit-tags.php?taxonomy=category');
    remove_submenu_page('edit.php', 'edit-tags.php?taxonomy=post_tag');
}

Leave a Comment