3

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?

4
  • DO you want to add the Custom Post under an Admin menu item? like: Post -> Custom post ? Commented Jul 12, 2012 at 10:51
  • Yes but not under Post, under one of my custom created menu items.
    – urok93
    Commented Jul 12, 2012 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
    Commented Jul 12, 2012 at 13:11
  • That's what I ended up doing, operation successful thanks
    – urok93
    Commented Jul 12, 2012 at 23:46

2 Answers 2

6

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'));
1
  • 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 ??? Commented Oct 19, 2016 at 14:02
1

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 and acknowledge you have read our privacy policy.

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