What this problem looks like
Database cleanup is not the same as deleting plugins. Orphan tables from removed plugins and autoloaded options often cause more bloat than post revisions.
Aggressive SQL without understanding breaks WooCommerce orders and page builder data. Prefer targeted tools with dry-run previews.
Safe cleanup with WP-CLI
wp comment delete $(wp comment list --status=spam --format=ids)
wp post delete $(wp post list --post_status=trash --format=ids) --force
wp transient delete --expired
wp cache flush
Limit post revisions going forward
Add to wp-config.php to cap future revision growth. Delete old revisions only after backup.
define( 'WP_POST_REVISIONS', 5 );
define( 'AUTOSAVE_INTERVAL', 120 );
Plugin-assisted cleanup
WP-Optimize and Advanced Database Cleaner show removable items with checkboxes. Review each category instead of select all blindly.
Find autoload bloat
Large autoloaded options slow every page. Remove only options tied to plugins you uninstalled.
wp db query "SELECT option_name, LENGTH(option_value) AS size FROM wp_options WHERE autoload='yes' ORDER BY size DESC LIMIT 20;"
After cleanup
- Test checkout, forms, and search.
- Regenerate critical CSS if a performance plugin requests it.
- Schedule quarterly cleanup instead of yearly panic deletes.
When to stop DIY and hire help
Shops with years of order data need surgical cleanup, not generic plugins. BugShield optimizes WordPress databases on maintenance plans with tested restore points.