Automating cleanup.
WHAT TO AUTOMATE
Clearing expired transients Removing old revisions Deleting spam comments Purging expired sessions Optimising tables occasionally
HOW
A maintenance plugin with a schedule, which requires working cron.
Or a script run from cron directly.
THE CRON REQUIREMENT
On our servers, HTTP requests to wp-cron.php are blocked. WordPress needs DISABLE_WP_CRON in wp-config.php and a real cron entry.
Without it, no scheduled maintenance runs, which is why bloat accumulates on so many sites.
TIMING
Quiet hours. Maintenance operations lock tables and consume resources.
FREQUENCY
Weekly for cleanup. Monthly for optimisation.
Daily is unnecessary and consumes resources without benefit.
LOGGING
Redirect script output to a log so you can confirm it ran.
A maintenance job that silently stopped months ago is common.
WHAT NOT TO AUTOMATE
Anything destructive you have not tested. Run it manually first and confirm the result.