rest_query_var-(key) filter-hook . WP 4.7.0
Filters the query_vars used in get_items() for the constructed query.
The dynamic portion of the hook name, $key, refers to the query_var key.
Usage
add_filter( 'rest_query_var-(key)', 'filter_function_name_7182' ); function filter_function_name_7182( $value ){ // filter... return $value; }
- $value(string)
- The query_var value.
Changelog
Since 4.7.0 | Introduced. |
Where the hook is called
rest_query_var-(key)
rest_query_var-(key)
wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php 998
$query_args[ $key ] = apply_filters( "rest_query_var-{$key}", $value ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php 514
$query_args[ $key ] = apply_filters( "rest_query_var-{$key}", $value ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores