woocommerce_version_string_invalidator_taxonomy_lookup_ttl │ хук-фильтр │ WC 10.5.0

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.

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

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.
По умолчанию: 300 (5 minutes)
$entity_type(строка)
The type of entity being invalidated ('product').

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

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

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

ProductVersionStringInvalidator::invalidate_products_with_term()
woocommerce_version_string_invalidator_taxonomy_lookup_ttl
ProductVersionStringInvalidator::invalidate_products_with_attribute()
woocommerce_version_string_invalidator_taxonomy_lookup_ttl
woocommerce/src/Internal/Caches/ProductVersionStringInvalidator.php 619
$ttl = apply_filters( 'woocommerce_version_string_invalidator_taxonomy_lookup_ttl', self::DEFAULT_TAXONOMY_LOOKUP_CACHE_TTL, 'product' );
woocommerce/src/Internal/Caches/ProductVersionStringInvalidator.php 673
$ttl = apply_filters( 'woocommerce_version_string_invalidator_taxonomy_lookup_ttl', self::DEFAULT_TAXONOMY_LOOKUP_CACHE_TTL, 'product' );

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

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