Make WordPress Core


Ignore:
Timestamp:
10/08/2020 01:30:25 AM (4 years ago)
Author:
TimothyBlynJacobs
Message:

REST API: Introduce search term handler.

This allows for clients to search the available terms via the /wp/v2/search endpoint by using a type=term query parameter.

Fixes #51458.
Props andraganescu, zieladam, noisysocks, TimothyBlynJacobs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/rest-api.php

    r49082 r49103  
    269269    $controller->register_routes();
    270270
     271    $search_handlers = array(
     272        new WP_REST_Post_Search_Handler(),
     273        new WP_REST_Term_Search_Handler(),
     274    );
     275
    271276    /**
    272277     * Filters the search handlers to use in the REST search controller.
     
    278283     *                               Default is only a handler for posts.
    279284     */
    280     $search_handlers = apply_filters( 'wp_rest_search_handlers', array( new WP_REST_Post_Search_Handler() ) );
     285    $search_handlers = apply_filters( 'wp_rest_search_handlers', $search_handlers );
    281286
    282287    $controller = new WP_REST_Search_Controller( $search_handlers );
Note: See TracChangeset for help on using the changeset viewer.