[wp-trac] [WordPress Trac] #30991: Post type object capability 'delete_posts' is referenced in the posts list table but does not exist unless 'map_meta_cap' is set to true for post type

WordPress Trac noreply at wordpress.org
Mon Jan 12 15:31:50 UTC 2015


#30991: Post type object capability 'delete_posts' is referenced in the posts list
table but does not exist unless 'map_meta_cap' is set to true for post type
-------------------------------+-----------------------------
 Reporter:  bamadesigner       |      Owner:
     Type:  defect (bug)       |     Status:  new
 Priority:  normal             |  Milestone:  Awaiting Review
Component:  Posts, Post Types  |    Version:  4.1
 Severity:  normal             |   Keywords:
  Focuses:  administration     |
-------------------------------+-----------------------------
 I'm getting the following error when viewing the main edit screen of a
 custom post type:

 Undefined property: stdClass::$delete_posts at wp-admin/includes/class-wp-
 posts-list-table.php:209

 When I looked up the line, the following code is run:

 {{{
 if ( current_user_can( $post_type_obj->cap->delete_posts ) ) {
 }}}

 The problem is that the capability, 'delete_posts', is only applied to a
 post type (via get_post_type_capabilities()) if the 'map_meta_cap'
 argument is set to true when you're registering the post type (via
 register_post_type()).

--
Ticket URL: <https://core.trac.wordpress.org/ticket/30991>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list