rest_query_var-(key) filter-hookWP 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)', 'wp_kama_rest_query_var_key_filter' );

/**
 * Function for `rest_query_var-(key)` filter-hook.
 * 
 * @param string $value The query_var value.
 *
 * @return string
 */
function wp_kama_rest_query_var_key_filter( $value ){

	// filter...
	return $value;
}
$value(string)
The query_var value.

Changelog

Since 4.7.0 Introduced.

Where the hook is called

WP_REST_Posts_Controller::prepare_items_query()
rest_query_var-(key)
WP_REST_Revisions_Controller::prepare_items_query()
rest_query_var-(key)
wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php 1134
$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 537
$query_args[ $key ] = apply_filters( "rest_query_var-{$key}", $value ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores

Where the hook is used in WordPress

Usage not found.