woocommerce_reports_cache_expiration │ filter-hook │ WC 11.3.0

Filters how long a reports cache value is kept, in seconds.

Usage

add_filter( 'woocommerce_reports_cache_expiration', 'wp_kama_woocommerce_reports_cache_expiration_filter', 10, 2 );

/**
 * Function for `woocommerce_reports_cache_expiration` filter-hook.
 * 
 * @param int    $expiration Time until expiration in seconds. Must be greater than 0; other values
 *                           use the default of one week.
 * @param string $key        Cache key.
 *
 * @return int
 */
function wp_kama_woocommerce_reports_cache_expiration_filter( $expiration, $key ){
	// filter...
	return $expiration;
}
$expiration(int)
Time until expiration in seconds. Must be greater than 0; other values use the default of one week.
$key(string)
Cache key.

Changelog

Since 11.3.0 Introduced.

Where the hook is called

Cache::set()
woocommerce_reports_cache_expiration
woocommerce/src/Admin/API/Reports/Cache.php 81
$expiration = apply_filters( 'woocommerce_reports_cache_expiration', WEEK_IN_SECONDS, $key );

Where the hook is used in WooCommerce

Usage not found.