[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
Fri Feb 21 01:55:26 UTC 2020


#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:  Mte90
     Type:  defect (bug)                         |      Status:  assigned
 Priority:  normal                               |   Milestone:  Future
                                                 |  Release
Component:  Posts, Post Types                    |     Version:  4.1
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch needs-dev-note has-unit-   |     Focuses:
  tests dev-feedback                             |  administration
-------------------------------------------------+-------------------------
Changes (by audrasjb):

 * milestone:  5.4 => Future Release


Old description:

> 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()).

New description:

 == 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()).

--

Comment:

 Hi,

 With 5.4 Beta 3 approaching and the Beta period reserved for bugs
 introduced during the cycle, this is being moved to Future Release. If any
 maintainer or committer feels this should be included or wishes to assume
 ownership during a specific cycle, feel free to update the milestone
 accordingly.

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


More information about the wp-trac mailing list