WordPress.org

Make WordPress Core


Ignore:
Timestamp:
04/05/2017 10:24:24 PM (2 years ago)
Author:
jnylen0
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php

    r40106 r40378  
    222222            'search'   => 'search',
    223223            'roles'    => 'role__in',
     224            'slug'     => 'nicename__in',
    224225        );
    225226
     
    262263            $prepared_args['search'] = '*' . $prepared_args['search'] . '*';
    263264        }
    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 
    270265        /**
    271266         * Filters WP_User_Query arguments when querying users via the REST API.
     
    13641359
    13651360        $query_params['slug']    = array(
    1366             'description'        => __( 'Limit result set to users with a specific slug.' ),
    1367             'type'               => 'string',
     1361            'description'        => __( 'Limit result set to users with one or more specific slugs.' ),
     1362            'type'               => 'array',
     1363            'items'              => array(
     1364                'type'               => 'string',
     1365            ),
    13681366        );
    13691367
Note: See TracChangeset for help on using the changeset viewer.