Also during clean_term_cache
This commit is contained in:
parent
4bce7b0223
commit
49c2f2b28e
|
@ -21,6 +21,7 @@ class WC_Cache_Helper {
|
|||
add_action( 'delete_version_transients', array( __CLASS__, 'delete_version_transients' ) );
|
||||
add_action( 'wp', array( __CLASS__, 'prevent_caching' ) );
|
||||
add_action( 'clean_taxonomy_cache', array( __CLASS__, 'clean_taxonomy_cache' ) );
|
||||
add_action( 'clean_term_cache', array( __CLASS__, 'clean_term_cache' ), 10, 2 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -216,6 +217,19 @@ class WC_Cache_Helper {
|
|||
wp_cache_delete( 'product-category-hierarchy', 'product_cat' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean term caches added by WooCommerce.
|
||||
*
|
||||
* @since 3.3.4
|
||||
* @param array $ids Array of ids to clear cache for.
|
||||
* @param string $taxonomy Taxonomy name.
|
||||
*/
|
||||
public static function clean_term_cache( $ids, $taxonomy ) {
|
||||
if ( 'product_cat' === $taxonomy ) {
|
||||
wp_cache_delete( 'product-category-hierarchy', 'product_cat' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WC_Cache_Helper::init();
|
||||
|
|
Loading…
Reference in New Issue