I have registered 2 post types:

register_post_type( 'post_type1' , $args1 );
register_post_type( 'post_type2' , $args2 );

And I've registered a custom taxonomy associated with the second post type:

register_taxonomy('post-type2-category', 'post_type2', array('hierarchical' => true, 'show_in_menu' => true, 'label' => esc_html__('My taxonomy', 'my_lang_slug'), 'singular_label' => esc_html__('My taxonomy', 'my_lang_slug'), 'rewrite' => true, 'slug' => 'post-type2-cat', 'show_in_nav_menus' => false));

I've also put in the $args2 variable, for second custom post type

'show_in_menu' => 'edit.php?post_type=post_type1',

So that my second custom post type appears in the same admin menu as the first one. But the problem is that now my taxonomy isn't showing. If I put the object type to first custom post type, then it shows before my second CPT. But I need the taxonomy only for my second CPT. I've tried with add_submenu_page(); but had no luck.

Is this possible?

  • Second one overrides the first post type. add_submenu_page() won't help you here. I guess you need to compromise either one here. Than add it separately – Kvvaradha Nov 22 '15 at 16:57
  • Yeah, I decided that I'll ditch the second one, and use taxonomy to differentiate between the two. Less hassle. – dingo_d Nov 22 '15 at 16:59
  • Yes. That's better way to go. Good luck. – Kvvaradha Nov 22 '15 at 17:00

Your Answer

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

Browse other questions tagged or ask your own question.