woocommerce_rest_api_cache_files_hash_data filter-hookWC 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.

Usage

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)
Array of file data, each with 'path' and 'time' keys.
$file_paths(array)
Original file paths passed to the method.
$controller(object)
Controller instance.

Changelog

Since 10.6.0 Introduced.

Where the hook is called

In file: /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
);

Where the hook is used in WooCommerce

Usage not found.