query_vars filter-hookWP 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.

Usage

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;
}
$public_query_vars(string[])
The array of allowed query variable names.

Changelog

Since 1.5.0 Introduced.

Where the hook is called

WP::parse_request()
query_vars
wp-includes/class-wp.php 311
$this->public_query_vars = apply_filters( 'query_vars', $this->public_query_vars );

Where the hook is used in WordPress

Usage not found.