enter image description here

I am using add_submenu_page to add a sub-level menu to a post type.

The problem is that the sub level menu “Batches” appears on top of the post type name “Offline Course” but I want it to appear at the bottom

// Register Custom Post Type
function register_offline_course() {

    $argscourse = array(
        'label'                 => __( 'Offline Course', 'Offline Course' ),
        'supports'              => array( 'title', 'editor', 'author', 'thumbnail', 'revisions', ),
        'taxonomies'            => array( 'offline_course_cat' ),
        'hierarchical'          => false,
        'public'                => true,
        'show_ui'               => true,
        'show_in_menu'          => true,
        'menu_position'         => 5,
        'show_in_admin_bar'     => true,
        'show_in_nav_menus'     => true,
        'can_export'            => true,
        'has_archive'           => false,       
        'exclude_from_search'   => false,
        'publicly_queryable'    => true,
        'capability_type'       => 'page',
    );
    register_post_type( 'course_offline', $argscourse );

    $argsbatch = array(
        'label'                 => __( 'Batch', 'Batch' ),
        'supports'              => array( 'title','revisions', ),
        'taxonomies'            => array( 'offline_course_cat' ),
        'hierarchical'          => false,
        'public'                => true,
        'show_ui'               => true,
        'show_in_menu'          => false,
        'menu_position'         => 5,
        'show_in_admin_bar'     => true,
        'show_in_nav_menus'     => true,
        'can_export'            => true,
        'has_archive'           => false,       
        'exclude_from_search'   => false,
        'publicly_queryable'    => true,
        'capability_type'       => 'page',
    );
    register_post_type( 'course_batches', $argsbatch );

    add_submenu_page( 'edit.php?post_type=course_offline', 'Batches', 'Batches',
    'manage_options', 'edit.php?post_type=course_batches', NULL );
}
add_action( 'init', 'register_offline_course', 0 );

Read more here: add_submenu_page() appearing on top of sub menu instead of bottom


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: