query_vars хук-фильтрWC 1.0

Filter the publicly allowed query vars.

Allows adjusting of the default query vars that are made public.

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

add_filter( 'query_vars', 'wp_kama_query_vars_filter' );

/**
 * Function for `query_vars` filter-hook.
 * 
 * @param array $public_query_vars Array of allowed WP_Query query vars.
 *
 * @return array
 */
function wp_kama_query_vars_filter( $public_query_vars ){

	// filter...
	return $public_query_vars;
}
$public_query_vars(массив)
Array of allowed WP_Query query vars.

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

WC_REST_Posts_Controller::get_allowed_query_vars()
query_vars
woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-posts-controller.php 555
$valid_vars = apply_filters( 'query_vars', $wp->public_query_vars );

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

woocommerce/includes/admin/list-tables/class-wc-admin-list-table-orders.php 52
add_filter( 'query_vars', array( $this, 'add_custom_query_var' ) );
woocommerce/includes/admin/list-tables/class-wc-admin-list-table-products.php 39
add_filter( 'query_vars', array( $this, 'add_custom_query_var' ) );
woocommerce/includes/class-wc-api.php 27
add_filter( 'query_vars', array( $this, 'add_query_vars' ), 0 );
woocommerce/includes/class-wc-auth.php 32
add_filter( 'query_vars', array( $this, 'add_query_vars' ), 0 );
woocommerce/includes/class-wc-query.php 55
add_filter( 'query_vars', array( $this, 'add_query_vars' ), 0 );