How to clear cache via Cron Job

If you want to make sure that cache is cleared at a certain time every day, you can  create a cron job (through your webhosting control panel, check this video as a quick guide - http://recordit.co/cl2YCoMCzu) and launch this function at whatever time you want: 

rocket_clean_domain();

http://docs.wp-rocket.me/article/12-rocketcleandomain

You can check detailed instructions in separate post here.

To do this, you have to create PHP file and name it what ever you want, for example rocket-clean-domain.php. Paste the following code inside:

<?php require( 'wp-load.php' );
	if ( function_exists( 'rocket_clean_domain' ) ) {
	rocket_clean_domain();
 }

Place this file in WordPress installation's root (where wp-config.php and wp-load.php are located).

You can check this short video -  http://recordit.co/jbtM0WPfcw

Note: If you place it on some other place, you need to edit path to wp-load.php in above's code   require( 'wp-load.php' ); to match its location.

Note: This function will only clear the cache, it doesn’t preload the cache. You have to use run_rocket_bot() or run_rocket_sitemap_preload() as well in order to trigger the preload.

Make sure to specify correct path to  rocket-clean-domain.php file in Cron Job settings.