• 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…

    https://www.ads-software.com/plugins/wp-fastest-cache/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Emre Vona

    (@emrevona)

    This feature is in our toDo list. You will decide that to clear all cache or only home when we release this feature. It will be available soon. I will let you know when we complete it.

    Thread Starter jmoria

    (@jmoria)

    Exellent!

    Here are few sugesstions for new features.

    In Delete Cache tab:

    New features (with button and action triggered at the moment when user click on the button, same as Delete Cache feature):
    Delete Homepage Cache
    Delete Posts Cache
    Delete Categories Cache
    Delete Pages Cache

    New features in the same tab, but with checkboxes (like in the Settings tab):
    if new post is published, delete cache of homepage + pages, categories & tags associated with the post
    if post is trashed, delete the cache of that post. Here can be added another bonus feature/function to check if trashed post is in the last 20-30 posts, if it is – delete homepage cache too.

    Example:

    if($new_status == "trash" && $old_status != "trash"){
    
    $args = array(
    'numberposts' => '3',
    'post_status' => 'publish'
    );
    
    $recent_posts = wp_get_recent_posts($args);
    foreach($recent_posts as $recent){
    	if( $recent['ID'] == $post_id ){
    		@unlink($this->getWpContentDir()."/cache/all/index.html");
    		@unlink($this->getWpContentDir()."/cache/wpfc-mobile-cache/index.html");
    	}
    }
    
    //here is some other code to delete cache of the trashed post
    }
    Thread Starter jmoria

    (@jmoria)

    *I forgot one zero in ‘numberposts’ => ‘3’. It should be ‘numberposts’ => ’30’. But you get it… ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Clear homepage cache after new post’ is closed to new replies.