query_vars хук-фильтрWP 1.5.0

Filters the query variables allowed before processing.

Allows (publicly allowed) query vars to be added, removed, or changed prior to executing the query. Needed to allow custom rewrite rules using your own arguments to work, or any other custom query variables you want to be publicly available.


add_filter( 'query_vars', 'wp_kama_query_vars_filter' );

 * Function for `query_vars` filter-hook.
 * @param string[] $public_query_vars The array of allowed query variable names.
 * @return string[]
function wp_kama_query_vars_filter( $public_query_vars ){

	// filter...
	return $public_query_vars;
The array of allowed query variable names.

Список изменений

С версии 1.5.0 Введена.

Где вызывается хук

wp-includes/class-wp.php 299
$this->public_query_vars = apply_filters( 'query_vars', $this->public_query_vars );

Где используется хук в WordPress

Использование не найдено.