I've created a menu page in the dashboard, then I created a custom post type and now I want to put the menu of the custom post type as a submenu under the first menu page I had created. I tried

'show_in_menu' => 'admin.php?page=mytestpage',

However that did not work. Any tips?

  • DO you want to add the Custom Post under an Admin menu item? like: Post -> Custom post ? – Pontus Abrahamsson Jul 12 '12 at 10:51
  • Yes but not under Post, under one of my custom created menu items. – urok93 Jul 12 '12 at 12:00
  • 1
    way not the other way around? create the custom post type and add your custom page as sub page to that. – Bainternet Jul 12 '12 at 13:11
  • That's what I ended up doing, operation successful thanks – urok93 Jul 12 '12 at 23:46

You only need to add the page slug to "show_in_menu", making the answer to your example:

'show_in_menu' => 'mytestpage',

For a more complete example:

Admin/Settings page of: /wp-admin/admin.php?page=mytestpage

register_post_type('mycpt', array('label' => 'My Custom Post Type', 'capability_type' => 'post', 'show_ui' => true, 'show_in_menu' => 'mytestpage'));
  • I did this and it failed to move the menu under the desired menu. :-(((( It did however remove the menu. 'show_in_menu' => 'mytestpage' is what I used. :-(((( I removed it and all was well again. Any other suggestions ??? – Miles Works Oct 19 '16 at 14:02

Ended up creating the custom post type and adding my custom page as sub page to that, as suggested by Bainternet

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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