woocommerce_rest_api_cache_files_hash_data хук-фильтрWC 10.6.0

Filter the file data used for REST API response cache invalidation.

This filter allows modification of the file tracking data before it is stored in the cache and used for invalidation checks.

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

add_filter( 'woocommerce_rest_api_cache_files_hash_data', 'wp_kama_woocommerce_rest_api_cache_files_hash_data_filter', 10, 3 );

/**
 * Function for `woocommerce_rest_api_cache_files_hash_data` filter-hook.
 * 
 * @param array  $files_data Array of file data, each with 'path' and 'time' keys.
 * @param array  $file_paths Original file paths passed to the method.
 * @param object $controller Controller instance.
 *
 * @return array
 */
function wp_kama_woocommerce_rest_api_cache_files_hash_data_filter( $files_data, $file_paths, $controller ){

	// filter...
	return $files_data;
}
$files_data(массив)
Array of file data, each with 'path' and 'time' keys.
$file_paths(массив)
Original file paths passed to the method.
$controller(объект)
Controller instance.

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

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

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

В файле: /src/Internal/Traits/RestApiCache.php
woocommerce_rest_api_cache_files_hash_data
woocommerce/src/Internal/Traits/RestApiCache.php 1138-1143
$files_data = apply_filters(
	'woocommerce_rest_api_cache_files_hash_data',
	$files_data,
	$file_paths,
	$this
);

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

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