How to Purge Cache with Cron Jobs

Purging cache with cron jobs can be useful if you want to purge a certain page on your site at a specific time every day, week, or month. This will prevent you from doing it manually every time and can save you some time and effort.

To be able to purge cache with cron jobs you need to have our plugin Servebolt Optimizer installed and activated. Moreover, there are multiple options for setting up automatic caching on your site. These options include Servebolt CDN, Accelerated Domains, or you can set up automatic caching through Cloudflare.

Activate cache purging in Servebolt Optimizer

To enable cache purging via cron jobs, you must activate the cache purging feature in our plugin. This can be done through Servebolt Optimizer in the WordPress dashboard.

How to set this up in our Control Panel

You can set this up directly in our Control Panel with just a few steps. First head over to the site in question and go to the crontab next to your site’s settings.

Shows where to add cron jobs in our Control Panel

In this example I want to purge my homepage every Sunday at 00:00. I would proceed to add this cron job to accomplish the task:

0 0 * * 7 wp servebolt cache purge url https://example.com/ --path=/YOUR/WEBROOT/DIRECTORY/public
Shows an example of an cron job that will purge cache every Sunday at 00:00

You can modify this according to your preferences. Remember that cron is based on the timezone where your Bolt is located.

NOTE: A great tool for helping you set up cron schedule expressions is crontab.guru


And as always, should you have any additional questions please don’t hesitate to contact our support chat at servebolt.com!