#46181 closed defect (bug) (duplicate)
Meta capabilities are not mapped completely when registering custom post type
| Reported by: | dingo_d | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Role/Capability | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
Description
When you register a custom post type (CPT), and set a capability to some string, you won't have delete_posts and delete_others_posts meta capabilities present, which will cause a PHP notice:
PHP Notice: Undefined property: stdClass::$delete_posts in /public_html/wp-admin/includes/class-wp-posts-list-table.php on line 400
I registered a documentation CPT and set
<?php add_action( 'init', function() { register_post_type( 'documentation', [ ..., 'capability_type' => 'documentation', 'map_meta_cap' => false, ] ); } );
Instead, I need to define custom capabilities array to avoid this error (and add the two).
Shouldn't this be done automatically?
Change History (2)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Duplicate of #30991.