WP_REST_Users_Controller::get_collection_params PHP Method

get_collection_params() public method

Retrieves the query params for collections.
Since: 4.7.0
public get_collection_params ( ) : array
return array Collection parameters.
    public function get_collection_params()
    {
        $query_params = parent::get_collection_params();
        $query_params['context']['default'] = 'view';
        $query_params['exclude'] = array('description' => __('Ensure result set excludes specific IDs.'), 'type' => 'array', 'items' => array('type' => 'integer'), 'default' => array());
        $query_params['include'] = array('description' => __('Limit result set to specific IDs.'), 'type' => 'array', 'items' => array('type' => 'integer'), 'default' => array());
        $query_params['offset'] = array('description' => __('Offset the result set by a specific number of items.'), 'type' => 'integer');
        $query_params['order'] = array('default' => 'asc', 'description' => __('Order sort attribute ascending or descending.'), 'enum' => array('asc', 'desc'), 'type' => 'string');
        $query_params['orderby'] = array('default' => 'name', 'description' => __('Sort collection by object attribute.'), 'enum' => array('id', 'include', 'name', 'registered_date', 'slug', 'email', 'url'), 'type' => 'string');
        $query_params['slug'] = array('description' => __('Limit result set to users with a specific slug.'), 'type' => 'string');
        $query_params['roles'] = array('description' => __('Limit result set to users matching at least one specific role provided. Accepts csv list or single role.'), 'type' => 'array', 'items' => array('type' => 'string'));
        /**
         * Filter collection parameters for the users controller.
         *
         * This filter registers the collection parameter, but does not map the
         * collection parameter to an internal WP_User_Query parameter.  Use the
         * `rest_user_query` filter to set WP_User_Query arguments.
         *
         * @since 4.7.0
         *
         * @param $params JSON Schema-formatted collection parameters.
         */
        return apply_filters('rest_user_collection_params', $query_params);
    }