Automattic\WooCommerce\Internal\ComingSoon
ComingSoonCacheInvalidator::invalidate_caches()
Invalidate the WordPress object cache and other known caches.
Method of the class: ComingSoonCacheInvalidator{}
No Hooks.
Returns
null
. Nothing (null).
Usage
$ComingSoonCacheInvalidator = new ComingSoonCacheInvalidator(); $ComingSoonCacheInvalidator->invalidate_caches();
ComingSoonCacheInvalidator::invalidate_caches() ComingSoonCacheInvalidator::invalidate caches code WC 9.8.5
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', ) ); } }