How to clear cache programatically ?
-
I want to clear cache of a page ( single product page ) when ever the stock status changes, Is there any way I can clear and regenerate cache for single-product page on
woocommerce_product_set_stock
hook,I tried
add_action( 'woocommerce_product_set_stock', 'le_product_stock_status_update' ); if ( is_plugin_active( 'wp-super-cache/wp-cache.php' ) ){ function le_product_stock_status_update($post_id = '') { global $blog_cache_dir, $wp_cache_object_cache; if ( $wp_cache_object_cache ) { reset_oc_version(); } else { prune_super_cache( $blog_cache_dir, true ); prune_super_cache( get_supercache_dir(), true ); } } }
.
- The topic ‘How to clear cache programatically ?’ is closed to new replies.