Purge URL's when new post is created

When a new post is created or editted the current post is probable purged.

But meanwhile the Blog listing page en Frontpage also contain a list of the post, so they also should be purged from the cache.
How to auto remove those urls when a post is created?

Are there functions/hooks to use auto auto purge other URLs?

Is that with APO? It seems that APO won’t purge the front page if it’s not the standard blog list page.

If you were to find a function/hook, how would you use it to trigger a purge?

It is with APO, and I oubt whether APO adds anything to the performance so thinking about cancelling that part.

The how would be easy
On update post → purge url A and B

Where would this process reside? Something needs to catch that signal and somehow execute the purge.

I ask because it’s something I’ve been looking at lately.

1 Like

Something like

add_action('save_post', 'cloudflare_do_something'); 

function cloudflare_do_something($arg){
   cloudflare_purge_url(''https://website.com');
   cloudflare_purge_url(''https://website.com/blogs/');
   cloudflare_purge_url(''https://website.com/about-us/');
}
2 Likes

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.