Make WordPress Core


Ignore:
Timestamp:
09/11/2022 09:10:31 PM (2 years ago)
Author:
TimothyBlynJacobs
Message:

REST API: Add support for searching resources by id.

This brings support for the include and exclude collection parameters to the Search Controller. This can be used to find an item by id when it's subtype is unknown.

Props kadamwhite.
Fixes #56546.

File:
1 edited

Legend:

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

    r53760 r54123  
    332332        );
    333333
     334        $query_params['exclude'] = array(
     335            'description' => __( 'Ensure result set excludes specific IDs.' ),
     336            'type'        => 'array',
     337            'items'       => array(
     338                'type' => 'integer',
     339            ),
     340            'default'     => array(),
     341        );
     342
     343        $query_params['include'] = array(
     344            'description' => __( 'Limit result set to specific IDs.' ),
     345            'type'        => 'array',
     346            'items'       => array(
     347                'type' => 'integer',
     348            ),
     349            'default'     => array(),
     350        );
     351
    334352        return $query_params;
    335353    }
Note: See TracChangeset for help on using the changeset viewer.