Is there any way to disable the option of adding a new post under a Custom Post Type in WordPress (3.0)? I've looked into labels and arguments but can't find anything that would resemble such a feature.
A:
May I ask why you want to do this?
I would at first have suggested changing the capabilities for your custom post type, but I don't think there's one that limits who can add posts, but only who can edit or publish them.
It looks a little dirty, but you could try unsetting the item in the $submenu
global;
function hide_add_new_custom_type()
{
global $submenu;
// replace my_type with the name of your post type
unset($submenu['edit.php?post_type=my_type'][10]);
}
add_action('admin_menu', 'hide_add_new_custom_type');
TheDeadMedic
2010-07-14 16:01:46
I only want 8 items available of a specific post type at any time in the admin (it's 8 parts of a product's details) and I figure an editor might make the mistake of adding one more post (even if I only output 8 it might mean the 9th will be fetched instead of another).I tried changing the post type capabilities without result.Your code worked excellent. Thanks!
Staffan Estberg
2010-07-21 08:48:52