Automattic\WooCommerce\Internal\ComingSoon
ComingSoonCacheInvalidator::invalidate_caches
Invalidate the WordPress object cache and other known caches.
Метод класса: ComingSoonCacheInvalidator{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$ComingSoonCacheInvalidator = new ComingSoonCacheInvalidator(); $ComingSoonCacheInvalidator->invalidate_caches();
Код ComingSoonCacheInvalidator::invalidate_caches() ComingSoonCacheInvalidator::invalidate caches WC 10.4.3
public function invalidate_caches() {
// Standard WordPress object cache invalidation.
wp_cache_flush();
/**
* Temporary solution to invalidate the WordPress.com Edge Cache. We can trigger
* invalidation by publishing any post. It should be refactored with a supported integration.
*/
$cart_page_id = get_option( 'woocommerce_cart_page_id' ) ?? null;
if ( $cart_page_id ) {
// Re-publish the coming soon page. Has the side-effect of invalidating the Edge Cache.
wp_update_post(
array(
'ID' => $cart_page_id,
'post_status' => 'publish',
)
);
}
}