Full credit to this answer on Stack Overflow: you need to set the create_posts value to do_not_allow (or false in WordPress versions below 4.5) and crucially set the map_meta_cap to true:
register_post_type( 'custom_post_type_name', array(
'capability_type' => 'post',
'capabilities' => array(
'create_posts' => 'do_not_allow', // Prior to WordPress 4.5, this was false
),
'map_meta_cap' => true, // With this set to true, users will still be able to edit & delete posts
));
Related Posts:
- Possible to hide Custom Post Type UI/Menu from specific User Roles?
- Custom post type role permissions won’t let me read
- How to assign specific users the capability to edit specific pages / posts / custom post types
- Custom Post Type Permalink Page Not Found
- Defining capabilities for custom post type
- Confusion with adding meta capabilities to a role after registering a Custom Post Type with corresponding ‘capability_type’ parameter
- Customize users’ capabilities to change a custom post’s post status
- Is it proper to create a page just to generate a listing page (eg. for a custom post type)
- Create user role restricted to specific CPT
- How to set individual capabilities on a taxonomy? Or how to re-register an existing taxonomy?
- Custom Post Types – Capability Type
- Where to put archive-{post-type}.php
- How to set a custom post type post as static front page?
- Custom Post Type Capabilities — Enable Edit, Disable Create and Delete
- Add Capabilities to Custom Post Type after it has been created [duplicate]
- When you create a custom post type, does that also create capabilities for editing/deleting that post type automatically?
- Managing event dates vs published dates in admin custom post type
- Custom post type archive sorted and grouped by date in post meta field
- WordPress allow access only one custom post type “xyz” to custom user role but need to hide all admin panels
- Assigning Multiple Layout Designs with Custom Pages in WordPress?
- How to retrieve custom field types for all posts in WordPress/PHP?
- Integrating Orbit slider into wordpress through custom post type
- Add custom capabilities to existing custom post type
- Allow Administrator role access to custom capabilities [duplicate]
- Generate Shortcodes by Taxonomy
- Made Custom Post Types, but single.php not working
- Is it possible to place custom post type files inside a folder in theme directory?
- One-to-many post relationships that are displayed by category (using posts-to-posts plugin)
- Custom Post Type Tag Capabilities Not Working
- current_user_can() return FALSE but debugging says TRUE
- Custom Post Type Capabilities
- Get term name and term parent into custom post type permalink
- Return the latest post from a custom Taxonomy and Post Type
- Don’t know how to show custom taxonomies from a custom post_type
- How to set individual capability of post type in individual category
- Giving permission to anyone (non-users as well) with a password to edit a post, possible?
- WooCommerce Customer Role Delete Custom Post Type
- How to change the post type a theme shows by default?
- Get unique superset of taxonomy terms from a list of custom posts in another hierarchical taxonomy
- Event Custom Post Type Title show by upcoming Event Dates
- “Submit for review” for updates on existing posts
- How to restrict author to only access one custom post type ?
- Custom post type submenu capabilities – custom plugin
- re-register custom post type with custom capabilities
- Custom post types and category archive
- How to produce a sub-page-system in WordPress
- Organize WordPress site, so it can maintain with huge database
- WebP Fallback for Inline Background Image in Style Attribute
- How to specify a template for a path like http://example.com/something?
- How can i link a custom post type thumbnail to intermediate size
- WordPress custom post type capabilities issue
- i cant see the max_num_pages of a custom wp query
- Archieve.php not loading for custom post type
- Display custom post using ID
- Specify a particular page to list all custom types
- Where is the sticky post option?
- Custom post type permalink sends to 404.php
- WP_Query with custom post type ID
- How to Use Custom Meta Field Instead of CPT Title in Post URL
- Capabilities not working with custom post type
- Wp custom post custom capability not working together
- Searching post types
- Admin: Get all user for Custom Role
- Add admin script to several post types
- Why does my URL keep returning 404 error code?
- How to exclude categories from a sidebar with active widgets in it?
- Creating an option for writing a post without an author attribution for a group blog on WordPress
- WordPress giving me the index
- Custom post category name showing empty
- Get next and prev item from custom WP_Query and Custom Post Type
- Why “Mine” is the default view when adding ‘capability_type’ in register_post_type
- Post type to appear on every page on site
- Page not found on custom post type page for projects
- Error 404 change permalink term custom term taxonomy
- Post template not applying on theme (potentially rendering as Page template)
- Custom Post Type Capabilities Singular/Plural
- Multiple useres editing specified content
- How to display only child category post in related posts in custom post type?
- Custom post type that lets users create a set of posts?
- Capibilities of CPT WordPress
- Links Image in “Catalog” Page to Posts
- WordPress is giving a warning but my code is working fine
- Not Able to Get Custom Post Type in Single and Single-custom-post-type
- How to develop custom URL redirection
- Loop carousel slider in wordpress
- Using piklist meta box, strange behavior
- Custom taxonomy page template
- get_pages can’t load pages with custom post types
- Prevent author role from editing others posts
- Cant insert wrapper div into index.php
- show custom taxonomies in hierarchy
- How can I detect a chosen Isotope layout option from within Javascript to generate appropriate layout?
- Not Able to Display Metabox Saved Checkbox and Selected option After Save/ Update
- Displaying information from Custom Fields in template with Types?
- How to manage wordpress knowledge base/wiki/posts collections
- Passing postid of Testimonial Custom Post in Shortcode Parameter
- Need some hints for my own WP theme development
- Show custom post type on post category page doesn’t work / breaks navigation
- Get a custom post type’s taxonomy type term names displayed as checkboxes and filter
- WP Query to display events and custom post type in a set order