Firing cache purge from wp hook


#1

Hi, I have a page that display a content using a shortcode. If I modify the content origin (but not the page itself) the cache is not purged. In effects I didn’t update the page itself. I can fire an hook when I change the “content origin”; so my question is: is there a function I can use inside an hook to fire the cache purge?

Thank you!


#2

You do not state the cache type you are using.

If you are using fastcgi_cache, then you should be able to use wp_remote_get($url) to access the /purge with the site location

So if your page is http://www.mywebsite.com/thepage, then the purge url will be http://www.mywebsite.com/purge/thepage

So you now need to send wp_remote_get the url http://www.mywebsite.com/purge/thepage

Im sure from that info you should be able to make a dynamic hook that any of those types of pages will get purged.

Good Luck !!


#3