How do I create multiple post types in same menu section in WP-admin?

I am building a custom menu section (a new item with subitems in the main menu section on the left side) in the WordPress Administration of my website. The section shall include a main post type, and for this you should be able to link category and country.

It would be possible to use taxonomies, but taxonomy only supports multiple choices. Therefore, I want to be able to create new post types for category and country instead of taxonomies.

But it won’t work out if I want it to be under the same menu section? Please help.

Solutions Collecting From Web of "How do I create multiple post types in same menu section in WP-admin?"

WordPress let’s you define where a post type appears in the args where you register it. It’s the show_in_menu argument. You can set it to true, false or a the slug (a string) of the page under which you’d like it to appear.

So, let’s say you already have a post type “main”. To display another post type under that you’d set the show_in_menu argument, like so:


// the register the post type
add_action( 'init', 'wpse4178_register' );
function wpse4178_register()
    // probably some more args up here.
    $args['show_in_menu'] = 'edit.php?post_type=main';
    register_post_type( 'country', $args );

You need to modify the menu individually by code, most certainly by a plugin. Administration Menus (WordPress Codex) contains a lot of information how the menu can be controlled. If nothing helps, you can directly control the menu via the associated global variable.