You probably cannot see the new CPT items in your menu, because you have indicated that they require specific caps, yet you have not assigned those same caps to any role – including your own.
Add the following to your code:
function my_cpt_add_caps() {
foreach ( array( 'administrator' ) as $role_name ) {
$role = get_role( $role_name );
$role->add_cap( 'edit_assignments' );
// add selected other caps here
}
}
register_activation_hook( __FILE__, 'my_cpt_add_caps' );
On plugin activation we assign your new caps to the admin role. Now, your CPT menu items should be available in the menu. Also, only now will plugins such as Members see these new caps, as a cap must be assigned to some role before it will be acknowledged.
As you are using capability_type
in your CPT registration, you can drop the capabilities
array, as WP will work this out itself.
Related Posts:
- How do I code access to the built-in UI of a CPT when it’s placed as submenu of another CPT that is protected by role?
- How to allow “Add New” capability of CPT when links to its UI are placed as a submenu?
- Custom post types as sub menu pages and role capabilities issue
- Able to edit custom post, but unable to create new custom post when within submenu. What capability is missing?
- Is It Possible To Add Custom Post Type Menu As Another Custom Post Type Sub Menu
- Possible to hide Custom Post Type UI/Menu from specific User Roles?
- Custom Post Type Settings page, choose page to display archive
- Allowing custom role access to custom post type in back end
- Show Custom Taxonomy Inside Custom Menu
- Remove “posts” from admin but show a custom post
- How to assign specific users the capability to edit specific pages / posts / custom post types
- Change capability type of post type registered by plugin
- Defining capabilities for custom post type
- 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?
- Customize users’ capabilities to change a custom post’s post status
- How Do I Programmatically Better Organize Custom Post Type Menus?
- Create user role restricted to specific CPT
- Is there a way to keep a custom menu expanded when editing a custom post type?
- How to set individual capabilities on a taxonomy? Or how to re-register an existing taxonomy?
- Custom Post Type Capabilities — Enable Edit, Disable Create and Delete
- Add Capabilities to Custom Post Type after it has been created [duplicate]
- How to remove/hide elements from the admin menu?
- 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)?
- WordPress allow access only one custom post type “xyz” to custom user role but need to hide all admin panels
- WordPress capability_type arguments
- Custom Post Type and taxonomies’s labels localization not working
- How can I use a different default admin menu icon for custom post type?
- Allow Users Access to Custom Post Type Only
- Custom Role can’t trash Custom Post Type
- Limit access to page depending on user level
- Custom Role for CPT Only
- Add management screens to post type
- Allow Administrator role access to custom capabilities [duplicate]
- How do I alter the position of a Custom Post Type menu item within my plugin admin menu?
- How to remove default tag and category options form a custom post type admin menu
- Prevent custom taxonomy from being added to admin menu?
- Custom Post Type / Tab Limit
- rewrite custom post type slug in wp admin
- How do increase the amount of links shown down the left in the admin menu?
- WordPress theme custom capabilities not works
- How to restrict CPT post’s fronted view only for specific user roles?
- current_user_can() return FALSE but debugging says TRUE
- Custom Post Type Capabilities
- How to set individual capability of post type in individual category
- WooCommerce Customer Role Delete Custom Post Type
- How to display Custom Taxonomy under Custom Admin Menu?
- Add Custom Post Type as top level menu item for a custom page
- Add Custom Post type menu to another menu in specific location
- Disable user from updating certain posts
- Access to CPT but not to ‘post’ post type
- How to remove post listing page for a custom post type
- How to restrict author to only access one custom post type ?
- Allow user to only access custom post type
- Custom post type submenu capabilities – custom plugin
- re-register custom post type with custom capabilities
- 2 Different Custom Post Types in Submenu
- Organize WordPress site, so it can maintain with huge database
- Ordering Submenu Pages in WP 3.1
- WordPress custom post type capabilities issue
- How to group navigation items in the admin panel
- WordPress: Custom User Role cannot access Custom Post Type | “Sorry, you are not allowed to access this page”
- Select other roles as custom post authors
- Capabilities not working with custom post type
- Reusable metabox backend and frontend
- Custom Post Type – after disable ‘Add New’, I can’t edit and delete post
- Wp custom post custom capability not working together
- Multiple custom post types showing up in edit.php
- Top level menu position overwrites another entry
- admin_head-post.php only works after publish / update
- Admin: Get all user for Custom Role
- adding page types in menu
- Metaboxes inside Tab
- Why “Mine” is the default view when adding ‘capability_type’ in register_post_type
- Restrict admin pages for specific user role
- How to only display all posts to a custom User Role?
- How can i redirect click to new admin page not to edit screen in post table
- Is there a way to display a custom post type menu item as “users” submenu?
- remove duplicate name submenu link from the custom post type
- Allowing custom role user to edit post assigned to them but don’t let them create new custom type post
- Custom Post Type Capabilities Singular/Plural
- Multiple useres editing specified content
- Subset of Custom Post Type From Admin Menu Based on Meta Data
- How to override post-new.php with custom template
- Setting up a page to house certain types of posts
- Capibilities of CPT WordPress
- Changing menu label to post name for custom post type
- Show custom taxonomy not in submenu
- Remove Custom Capability
- Prevent author role from editing others posts
- How to add elements to WordPress appearance->menu admin?
- Custom Post Type Causing Admin Sidebar UI Issue
- Issue on CPT Custom Menu Position in WP
- Custom Taxonomy Showing in WP Menu
- Show custom taxonomies in admin panel under custom post type
- Custom role, capabilities, and post type: preview button wrecks things
- Read-Only custom post type
- Understanding capabilities parameter in register_post_type()
- Can’t add custom post type archive page to menu