Opened 4 years ago
Closed 3 months ago
#55445 closed defect (bug) (wontfix)
Should WP_Post_Type preserve Array of capability_type?
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | minor | Version: | |
| Component: | Posts, Post Types | Keywords: | |
| Focuses: | Cc: |
Description
If I register a post type with capability_type as an array capbility_type => array( 'singular', 'plural' ). The WP_Post_Type object only holds onto the singular capability_type. Should the object preserve the array since it has singular and plural?
Change History (1)
Note: See
TracTickets for help on using
tickets.
https://developer.wordpress.org/reference/functions/get_post_type_capabilities/
By default WordPress uses singular, but if it has to use the plural for some specific capability that requires such, it will take the singular version with the "s" by the end.
Adding the plural explicitely is just to avoid this "s"-suffix behaviour, not to reference it at your convenience. Everything is preset and it will use the singular version when singular is hardcoded and the plural where plural is hardcoded.
Check this code snippet as a good example
As you can see, some capabilities are being referenced in the
singular_baseand others in theplural_base. This is whatcapability_typearrayis meant for.