mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
REST API: Allow fetching multiple users at once via the slug parameter.
This matches similar changes previously made for posts (#38579) and terms (#40027). Props curdin, MatheusGimenez. Fixes #40213. git-svn-id: https://develop.svn.wordpress.org/trunk@40378 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -221,6 +221,7 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
|
||||
'per_page' => 'number',
|
||||
'search' => 'search',
|
||||
'roles' => 'role__in',
|
||||
'slug' => 'nicename__in',
|
||||
);
|
||||
|
||||
$prepared_args = array();
|
||||
@@ -261,12 +262,6 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
|
||||
if ( ! empty( $prepared_args['search'] ) ) {
|
||||
$prepared_args['search'] = '*' . $prepared_args['search'] . '*';
|
||||
}
|
||||
|
||||
if ( isset( $registered['slug'] ) && ! empty( $request['slug'] ) ) {
|
||||
$prepared_args['search'] = $request['slug'];
|
||||
$prepared_args['search_columns'] = array( 'user_nicename' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters WP_User_Query arguments when querying users via the REST API.
|
||||
*
|
||||
@@ -1363,8 +1358,11 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
|
||||
);
|
||||
|
||||
$query_params['slug'] = array(
|
||||
'description' => __( 'Limit result set to users with a specific slug.' ),
|
||||
'type' => 'string',
|
||||
'description' => __( 'Limit result set to users with one or more specific slugs.' ),
|
||||
'type' => 'array',
|
||||
'items' => array(
|
||||
'type' => 'string',
|
||||
),
|
||||
);
|
||||
|
||||
$query_params['roles'] = array(
|
||||
|
||||
Reference in New Issue
Block a user