Make WordPress Core


Ignore:
Timestamp:
04/14/2017 08:46:22 AM (8 years ago)
Author:
swissspidy
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.

Merges [40378] to the 4.7 branch.

Location:
branches/4.7
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.7

  • branches/4.7/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php

    r40111 r40426  
    221221            'search'   => 'search',
    222222            'roles'    => 'role__in',
     223            'slug'     => 'nicename__in',
    223224        );
    224225
     
    261262            $prepared_args['search'] = '*' . $prepared_args['search'] . '*';
    262263        }
    263 
    264         if ( isset( $registered['slug'] ) && ! empty( $request['slug'] ) ) {
    265             $prepared_args['search'] = $request['slug'];
    266             $prepared_args['search_columns'] = array( 'user_nicename' );
    267         }
    268 
    269264        /**
    270265         * Filters WP_User_Query arguments when querying users via the REST API.
     
    13621357        $query_params['slug']    = array(
    13631358            'description'        => __( 'Limit result set to users with a specific slug.' ),
    1364             'type'               => 'string',
     1359            'type'               => 'array',
     1360            'items'              => array(
     1361                'type'               => 'string',
     1362            ),
    13651363        );
    13661364
Note: See TracChangeset for help on using the changeset viewer.