Automattic\WooCommerce\Internal\ProductFilters

TaxonomyHierarchyData::clear_cachepublicWC 1.0

Clear hierarchy cache for a taxonomy.

Method of the class: TaxonomyHierarchyData{}

No Hooks.

Returns

null. Nothing (null).

Usage

$TaxonomyHierarchyData = new TaxonomyHierarchyData();
$TaxonomyHierarchyData->clear_cache( $taxonomy ): void;
$taxonomy(string) (required)
The taxonomy name.

TaxonomyHierarchyData::clear_cache() code WC 10.3.3

public function clear_cache( string $taxonomy ): void {
	// Clear in-memory cache for this taxonomy.
	unset( $this->hierarchy_data[ $taxonomy ] );

	// Clear only the specific taxonomy's option cache.
	$cache_key = self::CACHE_GROUP . '_' . $taxonomy;
	delete_option( $cache_key );
}