Automattic\WooCommerce\Internal\Caches
ProductCacheController::invalidate_product_cache_by_meta
Invalidate the product cache when post meta is updated.
Метод класса: ProductCacheController{}
Хуков нет.
Возвращает
void. Ничего (null).
Использование
$ProductCacheController = new ProductCacheController(); $ProductCacheController->invalidate_product_cache_by_meta( $meta_id, $object_id ): void;
- $meta_id(int) (обязательный)
- The ID of the metadata entry.
- $object_id(int) (обязательный)
- The ID of the object the metadata is for.
Список изменений
| С версии 10.5.0 | Введена. |
Код ProductCacheController::invalidate_product_cache_by_meta() ProductCacheController::invalidate product cache by meta WC 11.2.2
public function invalidate_product_cache_by_meta( $meta_id, $object_id ): void {
$object_id = (int) $object_id;
if ( in_array( get_post_type( $object_id ), array( 'product', 'product_variation' ), true ) ) {
$this->invalidate_product_cache( $object_id );
}
}