386 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Has been a member for 4-5 years
  • United Kingdom
  • Referred between 100 and 199 users
  • Bought between 10 and 49 items
  • Exclusive Author
EugeneO says

I’m trying to create a custom post type that does not have the “Add New” option. The idea is that the pages for this post type will be automatically generated. I have the custom post type working fine but how do I edit the capabilities to prevent the “Add New” option from appearing?

2566 posts Put a Donk On It
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • United Kingdom
  • Exclusive Author
  • Attended a Community Meetup
  • Repeatedly helped protect Envato Market against copyright violations
  • Referred between 200 and 499 users
+5 more
ThemeProvince says

I think you possbly could use the capability_type parameter when you register a custom post type but im not too sure.

1148 posts
  • Beta Tester
  • Referred between 1 and 9 users
  • Sold between 1 000 and 5 000 dollars
  • Has been a member for 4-5 years
  • Bought between 10 and 49 items
  • Exclusive Author
  • United States
fillerspace says

There is a show_ui and show_in_menu parameter when you register a custom post type. Not sure if you want to completely hide these, or make them editable once automatically generated.

386 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Has been a member for 4-5 years
  • United Kingdom
  • Referred between 100 and 199 users
  • Bought between 10 and 49 items
  • Exclusive Author
EugeneO says

I have been reading about the capabilites and capatility_type parameters but I can’t get my head around them.

@fillerspace: I want users to be able to see and even edit the content from the admin dashboard once it has been generated but I do not want them to be able to create this type of content from scratch simply because there will be no need for them to. So I’m just looking for a way to remove the “Add New” buttons.

140 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • Referred between 1 and 9 users
  • Sold between 1 000 and 5 000 dollars
  • United States
weblusive says
Hi Eugene, here is a solution I came over:

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');

Not the most elegant solution, but it actually works. Please let me know if this helped.
386 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Has been a member for 4-5 years
  • United Kingdom
  • Referred between 100 and 199 users
  • Bought between 10 and 49 items
  • Exclusive Author
EugeneO says

Thanks for the try, weblusive. It’s almost a fix as it removes the “Add New” link in the sidebar but using your method the “Add New” button on the page that lists all the posts is still there.

2444 posts
  • Beta Tester
  • Has been a member for 5-6 years
  • Exclusive Author
  • Europe
  • Bought between 10 and 49 items
  • Referred between 100 and 199 users
  • Sold between 100 and 1 000 dollars
digitalimpact says

Hiding them with CSS would be another not-so-elegant solution… However, you’d still be able to access the “add new” directly…

by
by
by
by
by
by