Im using:

// wp-admin hotels list in sidebar
function add_custom_submenu_under_add_new() {
        'post_type' => 'hotel',
        'posts_per_page' => -1,
        'post_parent' => 0
    $the_query = new WP_Query( $args );
    if ( $the_query->have_posts() ) {
        while ( $the_query->have_posts() ) {
            global $post;
                'edit.php?post_type=hotel', // parent slug
                get_the_title($post->ID), // page title
                get_the_title($post->ID), // menu title
                'edit_posts', // capability (use the same as for editing posts)
add_action('admin_menu', 'add_custom_submenu_under_add_new');

To add custom menu to wp-admin sidebar under custom post type (hotel). What I need to do is to add second level menu to every created item, so I can show there subpages of this CPT. Is there any way to achieve that?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.