mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-02 17:40:01 +00:00
REST API: Synchronize permission checks in ::get_items_permissions_check() methods for post types, post statuses, and users:
* Only query post types with `'show_in_rest' => true` instead of looping over all post types and checking the `show_in_rest` property separately. * Return from the `foreach()` loop as soon as the permission check succeeded. Props pbiron, TimothyBlynJacobs, SergeyBiryukov. Fixes #49118. git-svn-id: https://develop.svn.wordpress.org/trunk@47034 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -89,6 +89,7 @@ class WP_REST_Post_Statuses_Controller extends WP_REST_Controller {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return new WP_Error( 'rest_cannot_view', __( 'Sorry, you are not allowed to manage post statuses.' ), array( 'status' => rest_authorization_required_code() ) );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user