collection_filter_query_param_keys хук-фильтрWC 11.7.0

Filters the active filter data provided by filter blocks.

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

add_filter( 'collection_filter_query_param_keys', 'wp_kama_collection_filter_query_param_keys_filter', 10, 2 );

/**
 * Function for `collection_filter_query_param_keys` filter-hook.
 * 
 * @param array $filter_param_keys The active filters data
 * @param array $url_param_keys    The query param parsed from the URL.
 *
 * @return array
 */
function wp_kama_collection_filter_query_param_keys_filter( $filter_param_keys, $url_param_keys ){

	// filter...
	return $filter_param_keys;
}
$filter_param_keys(массив)
The active filters data
$url_param_keys(массив)
The query param parsed from the URL.

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

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

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

ProductFilters::get_filter_params()
collection_filter_query_param_keys
woocommerce/src/Blocks/BlockTypes/ProductFilters.php 236
$filter_param_keys = array_unique( apply_filters( 'collection_filter_query_param_keys', array(), array_keys( $url_query_params ) ) );

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

woocommerce/src/Blocks/BlockTypes/ProductFilterAttribute.php 31
add_filter( 'collection_filter_query_param_keys', array( $this, 'get_filter_query_param_keys' ), 10, 2 );
woocommerce/src/Blocks/BlockTypes/ProductFilterPrice.php 32
add_filter( 'collection_filter_query_param_keys', array( $this, 'get_filter_query_param_keys' ), 10, 2 );
woocommerce/src/Blocks/BlockTypes/ProductFilterRating.php 33
add_filter( 'collection_filter_query_param_keys', array( $this, 'get_filter_query_param_keys' ), 10, 2 );
woocommerce/src/Blocks/BlockTypes/ProductFilterStatus.php 32
add_filter( 'collection_filter_query_param_keys', array( $this, 'get_filter_query_param_keys' ), 10, 2 );