399 posts
  • Has referred 100+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+5 more
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?

2588 posts Put a Donk On It
  • Elite Author: Sold more than $75,000 on Envato Market
  • Sells items exclusively on Envato Market
  • Made it to the Authors' Hall of Fame
  • Has sold $250,000+ on Envato Market
+10 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
  • Has referred 1+ members
  • Has sold $1,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 10+ items on Envato Market
+3 more
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.

399 posts
  • Has referred 100+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+5 more
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
  • Has been part of the Envato Community for over 4 years
  • Has referred 10+ members
  • Has sold $1,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+2 more
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.
399 posts
  • Has referred 100+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+5 more
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.

2468 posts
  • Has been part of the Envato Community for over 5 years
  • Has sold $100+ on Envato Market
  • Has referred 100+ members
  • Has been a beta tester for an Envato feature
+2 more
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…

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by