Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#46181 closed defect (bug) (duplicate)

Meta capabilities are not mapped completely when registering custom post type

Reported by: dingo_d's profile dingo_d Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Role/Capability Keywords:
Focuses: Cc:


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

  function() {
        '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)

#1 @swissspidy
5 years ago

  • Keywords dev-feedback 2nd-opinion removed
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #30991.

#2 @dingo_d
5 years ago

Flew under my radar, sorry for the duplicate :)

Note: See TracTickets for help on using tickets.