Ticket #40213: 40213.diff
File 40213.diff, 1.5 KB (added by , 8 years ago) |
---|
-
src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php
221 221 'per_page' => 'number', 222 222 'search' => 'search', 223 223 'roles' => 'role__in', 224 'slug' => 'nicename__in' 224 225 ); 225 226 226 227 $prepared_args = array(); … … 261 262 if ( ! empty( $prepared_args['search'] ) ) { 262 263 $prepared_args['search'] = '*' . $prepared_args['search'] . '*'; 263 264 } 264 265 if ( isset( $registered['slug'] ) && ! empty( $request['slug'] ) ) {266 $prepared_args['search'] = $request['slug'];267 $prepared_args['search_columns'] = array( 'user_nicename' );268 }269 270 265 /** 271 266 * Filters WP_User_Query arguments when querying users via the REST API. 272 267 * … … 278 273 * @param WP_REST_Request $request The current request. 279 274 */ 280 275 $prepared_args = apply_filters( 'rest_user_query', $prepared_args, $request ); 281 282 276 $query = new WP_User_Query( $prepared_args ); 283 277 284 278 $users = array(); … … 1363 1357 ); 1364 1358 1365 1359 $query_params['slug'] = array( 1366 'description' => __( 'Limit result set to users with a specific slug.' ), 1367 'type' => 'string', 1360 'description' => __( 'Limit result set to users with a specific slug.' ), 1361 'type' => 'array', 1362 'items' => array( 1363 'type' => 'string', 1364 ) 1368 1365 ); 1369 1366 1370 1367 $query_params['roles'] = array(