I am adding a large number of custom post types and taxonomies so it is often visually clearer if I DO NOT have them all added to the admin menu's top level. Instead I would prefer to add them under an appropriate sub-menu. I have done that without too much effort with this two step approach:

  1. Hiding CPT using the 'show_ui' property when registering the CPT
  2. Adding them back in using the add_submenu_page() call

For instance, here's an example of the the add_submenu_page call for a CPT called "companies":

add_submenu_page (LG_ADMIN_MENU,"Companies","Companies","manage_options",'edit.php?post_type=companies');

By taking these two steps I can now view the CPT, I can modify existing attributes, I can even delete a record but what I can't do is add a record. When I click on the "Add New" button it comes back with a white screen that only says "Invalid post type".

Now if I simply turn on the normal top-level menu (leaving all other settings alone), I get the menu now showing up both as a submenu (from my add_submenu_page call) and as a top-level menu (because I've turned that back on with "show_ui". I can then add new items with no problem.

  • could you edit your post so that there is a clear question?
    – Steve
    Nov 6, 2012 at 21:57

2 Answers 2


Have you tried show_in_menu instead?

register_post_type( 'companies', array(
     'show_in_menu' => LG_ADMIN_MENU,
     'show_ui' => true,
  • Ummm no. Seems like a really good idea on the surface. Let me try that now.
    – ken
    Nov 7, 2012 at 11:09
  • Ok, this seems to work. Great stuff!
    – ken
    Nov 7, 2012 at 11:30
  • One small remaining problem ... in most cases I see that the taxonomies attached to a CPT (who is in my own menu) follows the CPT to the new menu. In one case though, they just disappear. Any ideas?
    – ken
    Nov 7, 2012 at 11:31
  • Can you expand on "in one case"? Nov 7, 2012 at 11:47
  • The short version is "i'm an idiot". The slightly longer version is that you need to explicitly register the taxonomies into the menu with the add_submenu_page() which I done for the working ones but forgot I needed that for the others.
    – ken
    Nov 7, 2012 at 12:14

It isn't entirely clear which "add new" button you mean, but if you are talking about the "Add New" button that appears at the top of your "edit.php?post_type=" page (at least ordinarily) it is possible to alter that URL but it is 'hack-ie'. I think that is what you need to do though.

function reset_new_link() {
    global $post_new_file;
    $post_new_file = admin_url('whatever');

Take this code as a kind of proof of concept. You don't want to use it as is because it will change that link across the whole of the backend. You need to add conditions for when to change the link and when not to. Most of the information you need is probably in the $post_type_object object. Add global $post_type_object; var_dump($post_type_object); to see what you have to work with.

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.