mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-12 21:00:21 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@49103 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -268,6 +268,11 @@ function create_initial_rest_routes() {
|
||||
$controller = new WP_REST_Comments_Controller;
|
||||
$controller->register_routes();
|
||||
|
||||
$search_handlers = array(
|
||||
new WP_REST_Post_Search_Handler(),
|
||||
new WP_REST_Term_Search_Handler(),
|
||||
);
|
||||
|
||||
/**
|
||||
* Filters the search handlers to use in the REST search controller.
|
||||
*
|
||||
@@ -277,7 +282,7 @@ function create_initial_rest_routes() {
|
||||
* handler instance must extend the `WP_REST_Search_Handler` class.
|
||||
* Default is only a handler for posts.
|
||||
*/
|
||||
$search_handlers = apply_filters( 'wp_rest_search_handlers', array( new WP_REST_Post_Search_Handler() ) );
|
||||
$search_handlers = apply_filters( 'wp_rest_search_handlers', $search_handlers );
|
||||
|
||||
$controller = new WP_REST_Search_Controller( $search_handlers );
|
||||
$controller->register_routes();
|
||||
|
||||
Reference in New Issue
Block a user