Clear homepage cache after new post
-
I will be short and concise, because my english is disaster. I hope you will understand me.
I use static page for my homepage. When I publish new post, the cache for the homepage (..cache/all/index.html) is not deleted/cleared. It should, right? Or am I missing something? https://www.wpfastestcache.com/tutorial/to-clear-cache-after-update/
The feature “Clear Cache of Post After the Post is Updated” is working fine.
I tried everything, but no luck. The last option was to edit the code of the wpFastestCache.php
I have some basic PHP knowledge, but after some time I figure it out. I added the following code inside on_all_status_transitions function, and it solved my problem.
if($new_status == "publish" && $old_status != "publish"){
@unlink($this->getWpContentDir()."/cache/all/index.html");
@unlink($this->getWpContentDir()."/cache/wpfc-mobile-cache/index.html");
}
This code will delete the cache of the homepage (../cache/all/index.html) when new post is published.
This is very useful feature, because when you publish new post, in 99% of cases, the post go on homepage. If you delete all cache everytime you publish new post (including cache of posts) it’s not very practical. What if website have tens of thousand posts!? The plugin will delete all of them without need, right!?
So, at the end, I want to ask you: this is my problem (with my site or configuration) or this is plugin bug? Or maybe just a missing feature/option?
Thanks, and keep up the good work. Also, I have some recommendations, but later…
- The topic ‘Clear homepage cache after new post’ is closed to new replies.