cachify icon indicating copy to clipboard operation
cachify copied to clipboard

Flush cache via URL / cron job

Open Zodiac1978 opened this issue 4 years ago • 2 comments

Fastest Cache is providing a smart way to trigger the cache flush via Cron Job: https://www.wpfastestcache.com/features/clear-cache-via-url/

A user is asking if this is possible to implement in Cachify here: https://wordpress.org/support/topic/clear-cache-using-cron-job/

The documentation mentions some action hooks but no specific working code example to do that.

How about adding this feature in this or some other way?

Zodiac1978 avatar Jul 19 '21 08:07 Zodiac1978

One can simply add a custom Cron job utilizing the cachify_flush_cache action (no arguments required) action using for example WP Control. Then the cache is flushed periodically in the regular WP cron cycle.

Second option is using WP CLI, if CLI-level is applicable in the desired case. There is a flush action available yet.

Another option is calling the …?_cachify=flush URL behind the admin bar button via Cron. However this required an active session and a Nonce… We might consider migrating this function to an WP API endpoint (there are external auth mechanisms for the API so it can still be secured)

stklcode avatar Jul 19 '21 11:07 stklcode

I utilized WP Control plugin and seems to be working nicely. Maybe the documentation could include this solution.

Barnabas2 avatar Jul 26 '21 18:07 Barnabas2