Make WordPress Core


Ignore:
Timestamp:
09/11/2022 09:10:31 PM (21 months 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/search/class-wp-rest-term-search-handler.php

    r53877 r54123  
    6969        if ( ! empty( $request['search'] ) ) {
    7070            $query_args['search'] = $request['search'];
     71        }
     72
     73        if ( ! empty( $request['exclude'] ) ) {
     74            $query_args['exclude'] = $request['exclude'];
     75        }
     76
     77        if ( ! empty( $request['include'] ) ) {
     78            $query_args['include'] = $request['include'];
    7179        }
    7280
Note: See TracChangeset for help on using the changeset viewer.