Wordpress LScache Plugin: clear Cloudflare cache
Last Updated on: Wed, 15 Apr 2026 00:00:02 Hi In this page: /wp-admin/admin.php?page=lscache-dash#cdn you have a button to clear Cloudflare cache, this function can also be called from the wp-admin-bar-litespeed-menu . How can I call this function from a cron, once a day (for example) ? Thanks Alain This topic was modified 2 years, 9 months ago by Alain Aubry. Hi, Unfortunately LSCWP does no have command line or cron-job for this you need to manually to call Cloudflare API https://api.cloudflare.com/#zone-purge-all-files Best regards, Great info, but I am afraid is over my head to enable that by myself. Thank for your answer. Alain Hi, Its not hard to do so there is an example code curl -X POST https://api.cloudflare.com/client/v4/zones/023e105f4ecef8ad9ca31a8372d0c353/purge_cache -H X-Auth-Email: user@example.com -H X-Auth-Key: c2547eb745079dac9320b638f5e225cf483cc5cfdda41 -H Content-Type: application/json --data purge_everything :true you just need to create a system cron job for it CF support should help you to get the API and zone ID Best regards, Well, I know how to get the API and Zone iD, I dont know were I enter the curl code. Maybe another way of getting what I need is clearing the CF cache with every post update. I thought of using a cron because most post updates happens every day at the same time. Is it possible to do that? to sync the LSCache purge with CF cache? Alain Hi, No , LSCWP is not that deeply integrated with CF if you want to sync purge with CF cache , then you will probably need a PHPer to do some custom work. but for purge all cron will be much easier e.g. create a shell script , lets say script.sh with code line this #!/bin/bash curl -X POST https://api.cloudflare.com/client/v4/zones/023e105f4ecef8ad9ca31a8372d0c353/purge_cache -H X-Auth-Email: user@example.com -H X-Auth-Key: c2547eb745079dac9320b638f5e225cf483cc5cfdda41 -H Content-Type: application/json --data purge_everything :true save it to your system , e.g. /home/user/scritp.sh then create a cron job with whatever time frame you want to call that script e.g. 0 0 bash /home/user/script.sh this case , run that script at every day 00:00 I hope this can give you some ideas and hint to how to do this. Best regards, Ok, I understand. I will try it? Thanks a lot! @CacheCrawler Thank you si much! I enabled it in 2 sites that have timed publications, it is working amazingly. Any hint to synchronise it with post updates?
LiteCache Rush: Speed comes from using less, not from doing it faster
Reference