Make WordPress Core


Ignore:
Timestamp:
05/23/2020 03:22:53 PM (5 years ago)
Author:
ocean90
Message:

Role/Capability: Use meta caps edit_post, read_post, and delete_post directly.

Rather than consulting the post type object, let map_meta_cap() handle that for us.

Props peterwilsoncc, ocean90.
Fixes #50128.
See #23226.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php

    r47397 r47850  
    161161        }
    162162
    163         $parent_post_type_obj = get_post_type_object( $parent->post_type );
    164 
    165         if ( ! current_user_can( $parent_post_type_obj->cap->edit_post, $parent->ID ) ) {
     163        if ( ! current_user_can( 'edit_post', $parent->ID ) ) {
    166164            return new WP_Error(
    167165                'rest_cannot_read',
Note: See TracChangeset for help on using the changeset viewer.