This will give you guide how to clear cache manually on WP Rocket. This method will require to use a cron job on your server
- Download clear-cache-manual.php
- Upload it to your WordPress root directory. (where wp-config.php and wp-load.php are located).
- Execute it through your cron job of your server. Different server has it's own way to setup cron job.
- For the time format, it depends on when you want the script to be executed. For example if you want to execute it everyday on midnight (where there is less activities on your website) you can set it to
0 0 * * *
In cPanel it should be something like this:
You can use something like https://crontab.guru/ to get the exact time. - For the command, basic command will depend on what you want to do. For example if you want to execute a file, just put the path to the file in the command. Here is the example of how to run it on cPanel:
/usr/local/bin/php /home/username_cpanel/public_html/path/to/cron/script
This is the full example of how it setup on our server:
NOTE: I've tested the script and it works on my server. If it does not work, it's either you setup incorrectly or your server cron has an issue. please check the troubleshooting steps below:
- Does the file correctly placed in the root directory where wp-config.php and wp-load.php are located?
- Does the path directory in cron command has been correct?
- Does the time format correct?
- Ultimately, does the cron is running?
You can verify whether it's running or no by creating simple php script, something like
echo "cron is running"
save it as cron-test.php, then call it on cron by outputting the cron. This is the example:/usr/local/bin/php /home/u1068875/public_html/2023/cron-test.php > /home/u1068875/public_html/2023/cron-log.txt
/usr/local/bin/php
is php binary path/home/usernu1068875ame/public_html/2023/cron-test.php
is the php script path, in this case it's my cron-test.php/home/u1068875/public_html/2023/cron-log.txt
is where I want the cron output
If your cron is running, they should output file named cron-log.txt which contain the script
If you did not get the file, please contact your server administrator.