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

    (@emrevona)

    Did you check the cache files via ftp?

    Thread Starter jmoria

    (@jmoria)

    Last time I made the test on my local WAMP server, installed on my PC. Now I checked on my web server (1and1.com hosting), and found some very strange behavior.

    When I “Trash” a post, the “all” directory is deleted (../wp-content/cache/all), not just the cache of the trashed post. It’s because you use $this->deleteCache() (to delete whole cache) instead of $this->singleDeleteCache(false, $post->ID) (to delete only single post cache).

    BUT, I changed $this->deleteCache() to $this->singleDeleteCache(false, $post->ID) and again it’s not working. It’s very strange because a few lines below (on post update) it’s working fine, the cache of updated post is deleted, but when I use $this->singleDeleteCache(false, $post->ID) for trashed post – it’s not working.

    Everything is tested via FileZilla.

    Thread Starter jmoria

    (@jmoria)

    Also, I replaced $this->deleteCache() (line 678) with the code below, and it’s working fine, haha.

    $permalink = get_permalink($post_id);
    
    if(preg_match("/https?:\/\/[^\/]+\/(.+)/", $permalink, $out)){
    	$path = $this->getWpContentDir()."/cache/all/".$out[1];
    	$mobile_path = $this->getWpContentDir()."/cache/wpfc-mobile-cache/".$out[1];
    
    	if(is_dir($path)){
    		$this->rm_folder_recursively($path);
    	}
    	if(is_dir($mobile_path)){
    		$this->rm_folder_recursively($mobile_path);
    	}
    }
    Plugin Author Emre Vona

    (@emrevona)

    ok ??

    Thread Starter jmoria

    (@jmoria)

    So, what do you think? Will you update the plugin to delete only the cache of the trashed post, not the whole cache? It would be great if you do that, it’s much better than deleting whole cache when only one post is trashed.

    Also, do you have any clue why $this->singleDeleteCache(false, $post->ID) is not working for trashed post?

    Sorry for bothering you, I just want to make this plugin even better.

    Plugin Author Emre Vona

    (@emrevona)

    Only you wanted this feature. and this is not so important feature so I cannot promise ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Delete post cache after trash’ is closed to new replies.