- Timestamp:
- 01/03/2020 02:26:36 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php
r46823 r47034 200 200 201 201 if ( 'authors' === $request['who'] ) { 202 $ can_view = false;203 $types = get_post_types( array( 'show_in_rest' => true ), 'objects' ); 202 $types = get_post_types( array( 'show_in_rest' => true ), 'objects' ); 203 204 204 foreach ( $types as $type ) { 205 205 if ( post_type_supports( $type->name, 'author' ) 206 206 && current_user_can( $type->cap->edit_posts ) ) { 207 $can_view =true;207 return true; 208 208 } 209 209 } 210 if ( ! $can_view ) { 211 return new WP_Error( 'rest_forbidden_who', __( 'Sorry, you are not allowed to query users by this parameter.' ), array( 'status' => rest_authorization_required_code() ) ); 212 } 210 211 return new WP_Error( 'rest_forbidden_who', __( 'Sorry, you are not allowed to query users by this parameter.' ), array( 'status' => rest_authorization_required_code() ) ); 213 212 } 214 213
Note: See TracChangeset
for help on using the changeset viewer.