Title: Programmatically clear cache by post ID
Last modified: October 6, 2023

---

# Programmatically clear cache by post ID

 *  [Fetch Designs](https://wordpress.org/support/users/fetchdesigns/)
 * (@fetchdesigns)
 * [2 years, 8 months ago](https://wordpress.org/support/topic/programmatically-clear-cache-by-post-id/)
 * I need to programmatically trigger the cache to be cleared for a specific post,
   but so far the only thing I can find is using `do_action( ‘breeze_clear_all_cache’);`
   which will clear the entire cache which does not seem ideal nor performant. Does
   Breeze offer a way to trigger this by post ID?

Viewing 11 replies - 1 through 11 (of 11 total)

 *  Plugin Author [adeelkhan](https://wordpress.org/support/users/adeelkhan/)
 * (@adeelkhan)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/programmatically-clear-cache-by-post-id/#post-17112652)
 * Yes you may clear entire cache of application using “breeze_clear_all_cache”.
 * While update/edit post internal cache purge by Breeze to show the latest changes.
 *  Thread Starter [Fetch Designs](https://wordpress.org/support/users/fetchdesigns/)
 * (@fetchdesigns)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/programmatically-clear-cache-by-post-id/#post-17113309)
 * Are you saying there is no way to purge the cache **programmatically** for just
   a **single** post?
 *  Plugin Author [adeelkhan](https://wordpress.org/support/users/adeelkhan/)
 * (@adeelkhan)
 * [2 years, 7 months ago](https://wordpress.org/support/topic/programmatically-clear-cache-by-post-id/#post-17118892)
 * Yes, Breeze not offer to purge single post.
 *  [John Webber](https://wordpress.org/support/users/bilion/)
 * (@bilion)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/programmatically-clear-cache-by-post-id/#post-17277196)
 * Did you find a solution?
    -  This reply was modified 2 years, 5 months ago by [John Webber](https://wordpress.org/support/users/bilion/).
 *  Thread Starter [Fetch Designs](https://wordpress.org/support/users/fetchdesigns/)
 * (@fetchdesigns)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/programmatically-clear-cache-by-post-id/#post-17282723)
 * No, I did not find a solution and had to use the purse all cache which I’m not
   pleased about since it’s terrible for performance when all I need to purge is
   a single post.
 *  [John Webber](https://wordpress.org/support/users/bilion/)
 * (@bilion)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/programmatically-clear-cache-by-post-id/#post-17282763)
 * Does the cache of that single post get purged if you edit, or just save it?
 *  Plugin Author [adeelkhan](https://wordpress.org/support/users/adeelkhan/)
 * (@adeelkhan)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/programmatically-clear-cache-by-post-id/#post-17293891)
 * When updating a single post, Breeze purges the cache only for relevant post/page,
   not for the entire site. Clicking ‘Purge All Cache’ will clear the cache for 
   the entire site.
 *  [yidikaydk](https://wordpress.org/support/users/yidikaydk/)
 * (@yidikaydk)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/programmatically-clear-cache-by-post-id/#post-17319236)
 * Dear Adeel Khan and the Breeze Support Team,
 * I hope this message finds you well. I am currently working with the Breeze caching
   plugin and I have encountered a specific requirement that I believe may need 
   your expert guidance.
 * My objective is to programmatically clear the cache for individual posts by their
   Post ID. I am looking for a way to integrate this functionality directly into
   the Breeze plugin’s source code. I understand that modifying the plugin’s core
   files is not typically recommended, but this feature is crucial for my current
   project.
 * Could you kindly provide me with guidance on what modifications can be made to
   the plugin’s source code to achieve this functionality? Alternatively, if there
   is an existing hook or function within Breeze that I could utilize for this purpose,
   that information would be incredibly helpful.
 * Your expertise and advice on this matter would be greatly appreciated. Thank 
   you in advance for your time and assistance.
 * Best regards,
 *  Plugin Author [adeelkhan](https://wordpress.org/support/users/adeelkhan/)
 * (@adeelkhan)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/programmatically-clear-cache-by-post-id/#post-17350127)
 * Could you please provide more details on your request to purge the cache? Specifically,
   we would like clarification on whether you want to purge the cache not only in
   the general context but also specifically for Custom Post Types (CPT), tags, 
   and taxonomies. Your elaboration on this matter would be greatly appreciated.
 *  Thread Starter [Fetch Designs](https://wordpress.org/support/users/fetchdesigns/)
 * (@fetchdesigns)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/programmatically-clear-cache-by-post-id/#post-17359029)
 * In my case, it is for purging the cache of custom post types. For example, when
   a specific action occurs on the site I need to set up logic where it dynamically
   purges the cache for one or more individual posts in a custom post type.
 * In [W3 Total Cache](https://wordpress.org/plugins/w3-total-cache/), you do this
   by using 
   `w3tc_flush_post($post_id)`
 * In [WP Super Cache](https://wordpress.org/plugins/wp-super-cache/), you do this
   by using 
   `wpsc_delete_post_cache($post_id)`
 * In [WP-Optimize](https://wordpress.org/plugins/wp-optimize/), you do this by 
   using 
   `WPO_Page_Cache::_delete\_single\_post\_cache_($post_id)`
 * In [LiteSpeed Cache](https://wordpress.org/plugins/litespeed-cache/), you do 
   this by using 
   `do_action('litespeed_purge_post', $post_id)`
 * In [WP Fastest Cache](https://wordpress.org/plugins/wp-fastest-cache/), you do
   this by using 
   `wpfc_clear_post_cache_by_id($post_id)`
 *  [opicron](https://wordpress.org/support/users/opicron/)
 * (@opicron)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/programmatically-clear-cache-by-post-id/#post-17888421)
 * We need to be able to purge custom post type cache for Woocommerce Products after
   importing new data through CLI. In this case a purge cache per post ID would 
   be required.

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Programmatically clear cache by post ID’ is closed to new replies.

 * ![](https://ps.w.org/breeze/assets/icon-256x256.gif?rev=3352595)
 * [Breeze Cache](https://wordpress.org/plugins/breeze/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/breeze/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/breeze/)
 * [Active Topics](https://wordpress.org/support/plugin/breeze/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/breeze/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/breeze/reviews/)

 * 11 replies
 * 5 participants
 * Last reply from: [opicron](https://wordpress.org/support/users/opicron/)
 * Last activity: [1 year, 10 months ago](https://wordpress.org/support/topic/programmatically-clear-cache-by-post-id/#post-17888421)
 * Status: not resolved