wp_rest_search_handlers
Filters the search handlers to use in the REST search controller.
Usage
add_filter( 'wp_rest_search_handlers', 'wp_kama_rest_search_handlers_filter' ); /** * Function for `wp_rest_search_handlers` filter-hook. * * @param array $search_handlers List of search handlers to use in the controller. Each search handler instance must extend the `WP_REST_Search_Handler` class. * * @return array */ function wp_kama_rest_search_handlers_filter( $search_handlers ){ // filter... return $search_handlers; }
- $search_handlers(array)
- List of search handlers to use in the controller. Each search handler instance must extend the WP_REST_Search_Handler class.
Default: only a handler for posts
Changelog
Since 5.0.0 | Introduced. |
Where the hook is called
wp_rest_search_handlers
wp-includes/rest-api.php 313
$search_handlers = apply_filters( 'wp_rest_search_handlers', $search_handlers );