(hook_prefix)collection_params хук-фильтрWC 10.2.0

Filter the collection params.

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

add_filter( '(hook_prefix)collection_params', 'wp_kama_hook_prefixcollection_params_filter', 10, 2 );

/**
 * Function for `(hook_prefix)collection_params` filter-hook.
 * 
 * @param array $params The collection params.
 * @param       $that   
 *
 * @return array
 */
function wp_kama_hook_prefixcollection_params_filter( $params, $that ){

	// filter...
	return $params;
}
$params(массив)
The collection params.
$that
-

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

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

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

AbstractController::get_collection_params()
(hook_prefix)collection_params
woocommerce/src/Internal/RestApi/Routes/V4/AbstractController.php 107
return apply_filters( $this->get_hook_prefix() . 'collection_params', $params, $this );

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

woocommerce/includes/class-wc-brands.php 74
add_filter( 'rest_product_collection_params', array( $this, 'rest_api_product_collection_params' ), 10, 2 );
woocommerce/src/Blocks/BlockTypes/ProductCollection/Controller.php 80
add_filter( 'rest_product_collection_params', array( $this, 'extend_rest_query_allowed_params' ), 10, 1 );
woocommerce/src/Blocks/BlockTypes/ProductQuery.php 86
add_filter( 'rest_product_collection_params', array( $this, 'extend_rest_query_allowed_params' ), 10, 1 );