WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I wonder if there is possibility to generate WP-Super-Cache programmatically after the cache is being purged ( after I have published a new post ). I thought of writing some kind of crawler that will go trough all of my pages and generate new cache that way. But I wonder if there is another possibility?

P.S. I set up a setting that my cache is being purged after I published a new post, but what I need is that not all of my cache to be deleted, after I publish a new post, but only one for archives and categories ( because those are dynamic pages ) , so if there is an opportunity to somehow select what cache will be purged, there is no need to regenerate all of the cache, as I asked in the question. Hope I made it clear. Thanks.

share|improve this question

closed as off-topic by birgire, Pieter Goosen, Mark Kaplun, gmazzap, Johannes Pille Sep 15 '14 at 8:19

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Your question should be specific to WordPress. Generic PHP/JS/HTML/CSS questions might be better asked at Stack Overflow or another appropriate site of the Stack Exchange network. Third party plugins and themes are off topic." – birgire, Pieter Goosen, Mark Kaplun, gmazzap, Johannes Pille
If this question can be reworded to fit the rules in the help center, please edit the question.

WP-Super-Cache should be purging related caches when a post is published or changed. Is this not working right? – SickHippie Jun 28 '12 at 21:08
It is purging all cache ( there is such an option in plugin's settings ). – Godforever Jun 28 '12 at 21:09
So turn off the option to purge all cache. The plugin handles the rest of it. It will rebuild the related pages when first served up. In other words, this plugin already does what you want it to do - that's kinda the point of this type of plugin. – SickHippie Jun 28 '12 at 21:15
Alright, I did what you said, and basically I got what I wanted. But I faced one problem. In the right corner of my page I have a counter which show how many posts I have for last week, for today and at all. This counter is basically on each page. As the page is being cached, this counter shows the wrong number. How do I deal with that? – Godforever Jun 29 '12 at 10:25
From the WP Super Cache FAQ - "Other dynamic elements on a page may not update unless they are written in Javascript, Flash, Java or another client side browser language." In other words, if you have a php-driven counter on each page, you will need to flush the entire cache each time you post, or find a different counter that uses JavaScript to insert the number of posts. Alternately, you may have better luck with a different, more robust caching plugin - like W3 Total Cache, perhaps. It's harder to set up, but has more options for things like this. – SickHippie Jun 29 '12 at 16:05