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.

git-svn-id: https://develop.svn.wordpress.org/trunk@47850 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dominik Schilling
2020-05-23 15:22:53 +00:00
parent 584df2a169
commit f37a28858d
8 changed files with 17 additions and 30 deletions

View File

@@ -1774,7 +1774,7 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
}
if ( post_password_required( $post ) ) {
$result = current_user_can( $post_type->cap->edit_post, $post->ID );
$result = current_user_can( 'edit_post', $post->ID );
} else {
$result = $posts_controller->check_read_permission( $post );
}