mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
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:
@@ -1479,7 +1479,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
|
||||
}
|
||||
|
||||
// Is the post readable?
|
||||
if ( 'publish' === $post->post_status || current_user_can( $post_type->cap->read_post, $post->ID ) ) {
|
||||
if ( 'publish' === $post->post_status || current_user_can( 'read_post', $post->ID ) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1522,7 +1522,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
|
||||
return false;
|
||||
}
|
||||
|
||||
return current_user_can( $post_type->cap->edit_post, $post->ID );
|
||||
return current_user_can( 'edit_post', $post->ID );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1558,7 +1558,7 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
|
||||
return false;
|
||||
}
|
||||
|
||||
return current_user_can( $post_type->cap->delete_post, $post->ID );
|
||||
return current_user_can( 'delete_post', $post->ID );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user