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:
- Where to put my code: plugin or functions.php?
- Custom post type – order field
- Allowing custom role access to custom post type in back end
- Change capability type of post type registered by plugin
- Defining capabilities for custom post type
- How to put custom post types on front page
- How to set a fall back template for a custom post type in a plugin?
- How to add multiple images to a custom post type single post?
- Can I make user role that can only access a certian content type?
- REST API: How can I restrict a custom post type to only be accessible by authenticated users?
- Is it proper to create a page just to generate a listing page (eg. for a custom post type)
- How to set a custom post type post as static front page?
- Using Custom Meta Capabilities on Custom Post Type
- How to restrict specific post types from being read or added by specific user roles (eg. author)?
- Custom Search form not working in localhost
- Group search results by post type, but hide post types with no results
- WordPress capability_type arguments
- Multiple Content Block
- Message on Custom Posts Type admin page
- Allow Users Access to Custom Post Type Only
- How to allow “Add New” capability of CPT when links to its UI are placed as a submenu?
- Custom Role can’t trash Custom Post Type
- Limit access to page depending on user level
- How do I create an archive page for standard posts?
- Is it possible to associate different kinds of custom post types one to the other?
- Limit users by custom taxonomy and user roles
- Custom Role for CPT Only
- Remove parent from custom post type
- Allow Administrator role access to custom capabilities [duplicate]
- need advice on how to do a lists using custom post types – taxonomy vs postmeta
- How to add extra input fields to CPT’s comment form?
- How to Get Current Custom Post Type Selected Taxonomy Term (Not All Terms)
- Displaying a custom post types custom taxonomy value?
- Should I use custom menu, C.P.T. or theme options, or something else for this?
- WordPress theme custom capabilities not works
- How to restrict CPT post’s fronted view only for specific user roles?
- What template files do I need to customise custom-category-term-links rather than fall back on archive.php?
- Get term name and term parent into custom post type permalink
- Allow non-logged in users to see a future post after clicking on a list of future posts
- Query & Order posts by custom fields
- custom taxonamy and post type
- Custom post types as sub menu pages and role capabilities issue
- WooCommerce Customer Role Delete Custom Post Type
- How to Upload CSV Data into Custom Post Type Data with Metabox programmatically
- Disable user from updating certain posts
- Access to CPT but not to ‘post’ post type
- Allow user to only access custom post type
- How to produce a sub-page-system in WordPress
- How to specify a template for a path like http://example.com/something?
- 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
- Api rest_route 404 while building filter for custom posts (filtered by multiple meta keys / custom fields)
- how to get this tax_query working?
- Custom post type’s posts are not showing anywere but in xml sitemap
- How to Use Custom Meta Field Instead of CPT Title in Post URL
- Capabilities not working with custom post type
- Assign a template to a custom post type when displayed by the main loop on the home page
- If Post type use sidebar (‘tree’)
- Wp custom post custom capability not working together
- Add admin script to several post types
- Why does my URL keep returning 404 error code?
- Make Next and Previous on single-$posttype.php use the same order as archive-$posttype.php
- Custom post type posts wont show in wp_nav_menu()
- 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
- 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
- How to only display all posts to a custom User Role?
- Post template not applying on theme (potentially rendering as Page template)
- How to search through all child taxonomies using WP_Query?
- Custom Post Taxonomy Template Not Loading Properly
- 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?
- Create dynamic logo carousel without using any plugin
- Capibilities of CPT WordPress
- Links Image in “Catalog” Page to Posts
- Why get_posts() returns empty array while I am trying to get posts from some specific taxonomies and work properly with others?
- 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
- Remove Custom Capability
- Loop carousel slider in wordpress
- Using piklist meta box, strange behavior
- 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?
- Function that get ACF fields value before saving
- Create custom post order (with custom post type meta)
- Custom role, capabilities, and post type: preview button wrecks things
- Change position of Post Formats box?
- Single page for Custom Post Type not found
- 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