apply_filters( 'rest_term_search_query', array $query_args, WP_REST_Request $request )
- Since
- 5.6.0
Filters the query arguments for a REST API term search request.
Description
Enables adding extra arguments or setting defaults for a term search request.
Compatibility
- WordPress
- since 5.6.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Parameters
$query_argsarray- Key value array of query var to query value.
$requestWP_REST_Request- The request used.
Where this hook fires · 1
wp-includes/rest-api/search/class-wp-rest-term-search-handler.php:91WP_REST_Term_Search_Handler::search_items()
Source code
* * @since 5.6.0 * * @param array $query_args Key value array of query var to query value. * @param WP_REST_Request $request The request used. */ $query_args = apply_filters( 'rest_term_search_query', $query_args, $request ); $query = new WP_Term_Query(); $found_terms = $query->query( $query_args ); $found_ids = wp_list_pluck( $found_terms, 'term_id' ); unset( $query_args['offset'], $query_args['number'] );Changelog
Introduced in 5.6.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.