WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 9 months ago

#38714 new defect (bug)

Taxonomy meta boxes do not work right with Custom Post Types that use custom capabilities

Reported by: bcworkz Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.6
Component: Role/Capability Keywords:
Focuses: administration Cc:
PR Number:

Description

Category and tag taxonomies have the capability required for "assign_terms" set to "edit_posts", as in the global $wp_taxonomies['category']->cap->assign_terms for example. This becomes a problem with custom post types that define a custom capabilities array specifying a different edit capability and the usual "edit_posts" capability for particular roles is removed, though they have the proper edit CPT capability. Then the corresponding meta box on the CPT edit screen is not properly interactive.

For example, I create a CPT called "Contributions" and map the "edit_posts" capability to "edit_contributions". I also create a "Contributor" role that has all the expected capabilities for Contributions posts, including "edit_contributions" This role does not have the usual "edit_posts" and other default post and page capabilities, other than "read". The role also has "manage_categories" capability.

When logged in as a user with only the Contributor role, when I go to the edit contributions screen, I can see the categories meta box, but cannot assign any terms to the current contributions post. The checkboxes are inactive. Similarly for tags, I can see the tags meta box, but it has no content.

This issue was brought up in this forums post: https://wordpress.org/support/topic/custom-post-type-with-categories-and-tags-checkbox-disabled/

Change History (2)

This ticket was mentioned in Slack in #core by helen. View the logs.


3 years ago

#2 @helen
3 years ago

  • Version changed from trunk to 4.6
Note: See TracTickets for help on using tickets.