WC_Cache_Helper::clean_term_cache() public WC 3.3.4
Clean term caches added by WooCommerce.
{} Это метод класса: WC_Cache_Helper{}
Хуков нет.
Возвращает
Null. Ничего.
Использование
$result = WC_Cache_Helper::clean_term_cache( $ids, $taxonomy );
- $ids(массив/число) (обязательный)
- Array of ids or single ID to clear cache for.
- $taxonomy(строка) (обязательный)
- Taxonomy name.
Список изменений
С версии 3.3.4 | Введена. |
Код WC_Cache_Helper::clean_term_cache() WC Cache Helper::clean term cache WC 5.0.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' );
}
}
}