woocommerce_rest_api_cache_hooks_hash_data
Filter the data used to generate the hooks hash for REST API response caching.
Usage
add_filter( 'woocommerce_rest_api_cache_hooks_hash_data', 'wp_kama_woocommerce_rest_api_cache_hooks_hash_data_filter', 10, 3 );
/**
* Function for `woocommerce_rest_api_cache_hooks_hash_data` filter-hook.
*
* @param array $cache_hash_data Hook callbacks data used for hash generation.
* @param array $hook_names Hook names being tracked.
* @param object $controller Controller instance.
*
* @return array
*/
function wp_kama_woocommerce_rest_api_cache_hooks_hash_data_filter( $cache_hash_data, $hook_names, $controller ){
// filter...
return $cache_hash_data;
}
- $cache_hash_data(array)
- Hook callbacks data used for hash generation.
- $hook_names(array)
- Hook names being tracked.
- $controller(object)
- Controller instance.
Changelog
| Since 10.5.0 | Introduced. |
Where the hook is called
woocommerce_rest_api_cache_hooks_hash_data
woocommerce/src/Internal/Traits/RestApiCache.php 980-985
$cache_hash_data = apply_filters( 'woocommerce_rest_api_cache_hooks_hash_data', $cache_hash_data, $hook_names, $this );