0

I've worked out how to add tags to custom post types using

'taxonomies' => array('post_tag')

However this adds another "Tags" submenu under my custom post type menu which I do not want. How do I remove this submenu?

enter image description here

2

To remove the submenu Tags link from the admin menu, you might try

add_action( 'admin_menu', 'custom_admin_menu' );
function custom_admin_menu() {
        // debug to find the correct submenu slug:
        // global $submenu;
        // print_r($submenu);

        $menu_slug = 'edit.php?post_type=infographics';
        $submenu_slug = 'edit-tags.php?taxonomy=post_tag&post_type=infographics';

        remove_submenu_page( $menu_slug, $submenu_slug );
}

if your custom post type is infograhpics.

By viewing the global $submenu array you can find the correct menu slugs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.