apply_filters( "rest_{$this->taxonomy}_query", array $prepared_args, WP_REST_Request $request )
- Since
- 4.7.0
Filters get_terms() arguments when querying terms via the REST API.
Description
The dynamic portion of the hook name, $this->taxonomy, refers to the taxonomy slug.
Possible hook names include:
rest_category_queryrest_post_tag_query
Enables adding extra arguments or setting defaults for a terms collection request.
Compatibility
- WordPress
- since 4.7.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
$prepared_argsarray- Array of arguments for get_terms().
$requestWP_REST_Request- The REST API request.
Where this hook fires · 1
wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php:343WP_REST_Terms_Controller::get_items()
Source code
* * @link https://developer.wordpress.org/reference/functions/get_terms/ * * @param array $prepared_args Array of arguments for get_terms(). * @param WP_REST_Request $request The REST API request. */ $prepared_args = apply_filters( "rest_{$this->taxonomy}_query", $prepared_args, $request ); if ( ! empty( $prepared_args['post'] ) ) { $query_result = wp_get_object_terms( $prepared_args['post'], $this->taxonomy, $prepared_args ); // Used when calling wp_count_terms() below. $prepared_args['object_ids'] = $prepared_args['post'];Changelog
Introduced in 4.7.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.