Issue with Autoptimize Cache filling up cPanel Server Space.
As a temporary fix, just run a cron to delete all the cache files once an hour.
– I have only seen this issue with a Multisite install, but I haven’t had a problem on single site installs.
Log into cPanel go to CRONs
Under ‘Add a New Cron Job’ use the following settings:
Minute: 7
Hour: *
Day: *
Month: *
Weekday: *
Under the command section you need to first work out where your WordPress site is installed,
usually under cPanel it is under /home/[your_cpanel_username]/public_html/
Then you need to add the folder of the Autoptimize Cache folder, so the entire thing looks something like this:
/home/[your_cpanel_username]/public_html/wp-content/wp-content/cache/autoptimize/
Add the command rm -r at the start, put it all together and you have the right command:
!IMPORTANT! – The command rm -r will delete everything in the folder, if you get the path to the folder wrong, you could delete your entire website. You have been warned!
rm -r /home/[your_cpanel_username]/public_html/wp-content/wp-content/cache/autoptimize/
So what we are doing is just at 7 minutes past the hour, of all hours, of all days, of all months, each weekday (that’s how you read the * in the cron) we delete all the files in the folder that we told it too.
Great post! Frank, one of the developers of Autoptimize is super anti-automation. Too bad because it is a pretty good plugin! If I may recommend an addition to your post is to add a parallel cron to delete the cache as well this will keep the site from breaking. I am using Cache Enabler (seem to work best with Autoptimize) in this case you need to delete the content at /cache/cache-enabler/ as well!