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
- Capabilities and Custom Post Types
- Possible to hide Custom Post Type UI/Menu from specific User Roles?
- Placing a Custom Post Type Menu Above the Posts Menu Using menu_position?
- Custom Post Type Settings page, choose page to display archive
- Custom post type role permissions won’t let me read
- Allowing custom role access to custom post type in back end
- Put update-like notification bubble on multiple CPTs menus for pending items
- Meta Boxes: ‘admin_init’ or ‘add_meta_boxes’ hook?
- 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
- Allow user to Edit Posts but not Add New?
- 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
- Can I have Post Types under other Post Types in Admin menu?
- Is it OK to move admin menu items?
- 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
- Notice: map_meta_cap was called incorrectly
- How Do I Programmatically Better Organize Custom Post Type Menus?
- Add Post type menu to another menu
- How do I create multiple post types in same menu section in WP-admin?
- 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 Types – Capability Type
- Custom Post Type Capabilities — Enable Edit, Disable Create and Delete
- Menu position (admin menu) of pages
- Add Capabilities to Custom Post Type after it has been created [duplicate]
- How to not allow custom roles to edit published custom post types?
- When you create a custom post type, does that also create capabilities for editing/deleting that post type automatically?
- How to remove/hide elements from the admin menu?
- Using Custom Meta Capabilities on Custom Post Type
- Remove Custom Post Type menu for non-administrator users.
- 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 to only have one custom post type post?
- How can I use a different default admin menu icon for custom post type?
- Custom role capabilities to administrator not taking effect (no plugin)
- Prevent author role from editing all posts in custom post type?
- Allow Users Access to Custom Post Type Only
- Custom Role can’t trash Custom Post Type
- How to add new tab to admin list of posts and handle result list
- Limit access to page depending on user level
- Role Capabilities: Add New Ones?
- Displaying different custom post types under one admin menu
- Custom post type capabilities require “create_posts” to access the edit posts list page
- Notice: Undefined property: stdClass::$delete_posts with custom post type
- Custom Role for CPT Only
- Add custom capabilities to existing custom post type
- Add management screens to post type
- allow edit of custom post type but not regular posts?
- 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 add custom post type under option page
- How to remove default tag and category options form a custom post type admin menu
- Prevent custom taxonomy from being added to admin menu?
- Trying to add script to specific admin page is not working
- Custom Post Type / Tab Limit
- Why is my Custom Post Type not showing up after adding capabilities?
- rewrite custom post type slug in wp admin
- Cannot attach media when capabilities added to custom post type
- How do increase the amount of links shown down the left in the admin menu?
- Move custom post menu to under plugin admin menu
- Custom Post Type Tag Capabilities Not Working
- WordPress theme custom capabilities not works
- How to restrict CPT post’s fronted view only for specific user roles?
- Insert & order custom post types in/as submenu
- current_user_can() return FALSE but debugging says TRUE
- Role capability delete multiple post type posts doesn’t work
- With two custom post types, how to make one a child of the other in the admin menu?
- Custom Post Type Capabilities
- map_meta_cap woes
- Roles for Custom Post Types
- can’t see custom post content filtered under “mine” filter in admin panel
- Define new user capability for custom post types?
- Adding user capabilities for a custom taxonomy of a custom post type for a custom user
- How to set individual capability of post type in individual category
- Restrict Access to Posts based on Custom User and Post Meta Data
- Giving permission to anyone (non-users as well) with a password to edit a post, possible?
- read_post meta capability for anonymous users
- WooCommerce Customer Role Delete Custom Post Type
- How to display Custom Taxonomy under Custom Admin Menu?
- delete_published_posts does not work
- Permit users with author role to edit a custom post type
- Add Custom Post Type as top level menu item for a custom page
- Possibilities for the edit.php admin panel? [closed]
- Add Custom Post type menu to another menu in specific location
- Disable user from updating certain posts
- “Submit for review” for updates on existing posts
- Access to CPT but not to ‘post’ post type