I am writing a plugin and I have added a custom post type
register_post_type( ‘my_cpt’, $args);
I would like to have it linked to the custom admin menu I have created using
add_menu_page( ‘Page Title’, ‘Menu Item’, ‘manage_options’, ‘myplugin_page’, ‘mycallback’, ‘some_icon’, 10);
I basically want the top-level Admin Menu above to show the view that has all the posts for this CPT and has the option to add new below. I was able to get it somewhat working using
add_menu_page( ‘Page Title’, ‘Menu Item’, ‘manage_options’, ‘edit.php?post_type=my_cpt’, ‘mycallback’, ‘some_icon’, 10);
This allowed the CPT to be on the Top level menu but only adding new posts had the correct view. The list of CPTs was not on the main menu item page.
Also, all the subpages were gone, since the slug for the top level menu item was gone.
How can I accomplish what I am trying to do? The top level admin page should be edit.php?post_type=my_cpt, below it I want the first submenu to point to post-new.php?post_type=my_cpt then the other submenus I can do what I want with them.
I have seen others add CPT to submenus. How do I add to the top level menu?
Read more here:: Add Custom Post Type as top level menu item for a custom page