woocommerce_version_string_invalidator_taxonomy_lookup_ttl
Filters the cache TTL for queries that find entities associated with a term or taxonomy.
These queries are used during cache invalidation to determine which entities (e.g., products, variations) need their cache cleared when a term or attribute changes.
Usage
add_filter( 'woocommerce_version_string_invalidator_taxonomy_lookup_ttl', 'wp_kama_woocommerce_version_string_invalidator_taxonomy_lookup_ttl_filter', 10, 2 );
/**
* Function for `woocommerce_version_string_invalidator_taxonomy_lookup_ttl` filter-hook.
*
* @param int $ttl Cache TTL in seconds.
* @param string $entity_type The type of entity being invalidated ('product').
*
* @return int
*/
function wp_kama_woocommerce_version_string_invalidator_taxonomy_lookup_ttl_filter( $ttl, $entity_type ){
// filter...
return $ttl;
}
- $ttl(int)
- Cache TTL in seconds.
Default: 300 (5 minutes) - $entity_type(string)
- The type of entity being invalidated ('product').
Changelog
| Since 10.5.0 | Introduced. |
Where the hook is called
woocommerce_version_string_invalidator_taxonomy_lookup_ttl
woocommerce_version_string_invalidator_taxonomy_lookup_ttl
woocommerce/src/Internal/Caches/ProductVersionStringInvalidator.php 617
$ttl = apply_filters( 'woocommerce_version_string_invalidator_taxonomy_lookup_ttl', self::DEFAULT_TAXONOMY_LOOKUP_CACHE_TTL, 'product' );
woocommerce/src/Internal/Caches/ProductVersionStringInvalidator.php 671
$ttl = apply_filters( 'woocommerce_version_string_invalidator_taxonomy_lookup_ttl', self::DEFAULT_TAXONOMY_LOOKUP_CACHE_TTL, 'product' );