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:

<?php

// 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 );
}

Leave a Comment