Open Magnet77 opened 7 years ago
Any news on this?
@Magnet77 @Lofesa
The new release 2.1.0 introduced a new filter rt_nginx_helper_purge_url
(see #203 ) to add wildcard purging of URLs.
We will try to add this capability to the plugin itself in the next release. But for now, you can use it something like this in the theme's function.php.
add_filter( 'rt_nginx_helper_purge_url', function( $url ) {
// Delete cache of single post and it's /amp or /?amp page.
if ( is_single() ) {
$url = $url . '*';
}
return $url;
});
Please use it in a staging site or dev site first and see if cache purging works on post update.
Hi @pradeep910
But this hook work for redis not for fastcgi file cache, rigth?
EDIT: For fastcgi cache I have made these changes:
file admin/class-purger.php:
added a new line 391 -> if ( !empty($url_data['query']) ){ $arg_sep = '?'; }
changed line 392 -> $hash = md5( $url_data['scheme'] . 'GET' . $url_data['host'] . $url_data['path'].$arg_sep.$url_data['query'] );
file class-fastcgi-purger.php:
added new line 53 $_url_purge_amp = $_url_purge.'?amp';
added new line 60 $this->delete_cache_file_for( $_url_purge_amp );
As far as I have not enabled comments I have not make any change to comments.
This plugin is perfectly working with all post types. One extra functionality will make this super perfect. :) Add the ability to purge AMP pages when post or page updated. Please help me with this.