WordPress at Your Fingertips
function is not described

WC_Cache_Helper::clean_term_cache() public WC 3.3.4

Clean term caches added by WooCommerce.

{} It's a method of the class: WC_Cache_Helper{}

No Hooks.

Return

null. Nothing.

Usage

$result = WC_Cache_Helper::clean_term_cache( $ids, $taxonomy );
$ids(array|int) (required)
Array of ids or single ID to clear cache for.
$taxonomy(string) (required)
Taxonomy name.

Changelog

Since 3.3.4 Introduced.

Code of WC_Cache_Helper::clean_term_cache() WC 5.9.0

public static function clean_term_cache( $ids, $taxonomy ) {
	if ( 'product_cat' === $taxonomy ) {
		$ids = is_array( $ids ) ? $ids : array( $ids );

		$clear_ids = array( 0 );

		foreach ( $ids as $id ) {
			$clear_ids[] = $id;
			$clear_ids   = array_merge( $clear_ids, get_ancestors( $id, 'product_cat', 'taxonomy' ) );
		}

		$clear_ids = array_unique( $clear_ids );

		foreach ( $clear_ids as $id ) {
			wp_cache_delete( 'product-category-hierarchy-' . $id, 'product_cat' );
		}
	}
}