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?

1 Answer 1


You don't need to add the admin menu yourself, when registering your post type just make sure you set the public argument to true. If the post type isn't public, then make sure at least show_ui is true. Then the menus will be created for you.

register_post_type( 'my_cpt', array(
    'public'  => true,
    'show_ui' => true,
) );

Refer to the documentation for the arguments that determine where in the menu it appears and what icon is used.

  • I think you misunderstand, I want the admin menus for the CPT to be used in custom admin menus I am creating. I was wondering if I should add my sub menus to the CPT admin menu. Is that how I am supposed to accomplish what I want....
    – Courtney
    Jul 31, 2018 at 11:08

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.