
Every WordPress site accumulates: post revisions nobody will read, orphaned metadata from deleted plugins, spam comments, expired transients, auto-drafts from 2019. Cleanup plugins handle the mechanical part well. What they cannot do is tell you what is safe to delete on your particular site — and that judgement is where an agent helps.
Every write below goes through the same shape: the agent reads first, shows a plan, and nothing is written until you approve it — with the whole run in the audit log. For database work, that matters more than usual.
The valuable step is the inventory, because it tells you what is worth doing:
Audit this site's database bloat:
- revisions per post (top 20) and total revision count
- orphaned post meta rows, grouped by meta_key with counts
- spam/trash comments, transients, auto-drafts
- media attachments not referenced by any post content or featured image
- tables not belonging to any active plugin
For each: how much space, and how confident are you it's safe to remove?
Do not delete anything.
# limit future revisions (wp-config.php)
define('WP_POST_REVISIONS', 5);
A reasonable division: agent produces the audit and the plan; you approve each category; deletions run through the site's own tools or a maintenance plugin, with the agent verifying afterwards that nothing broke.
After the cleanup: check that a sample of 20 pages still render,
that featured images still resolve, and that no page-builder content
references a missing attachment. Report anything broken.
Cleanup is a symptom fix. Four settings and habits stop most of it recurring:
Custom tables left by removed plugins are the most persistent category, because nothing in WordPress knows they are orphaned. An agent can reason about it usefully:
List every database table with the site prefix that does not belong to
WordPress core. For each: guess which plugin created it (from the name
and its columns), and whether that plugin is currently active.
Rank by size. Recommend nothing — I'll decide.
It can audit it precisely — revisions, orphaned meta by key, transients, spam, unreferenced media, abandoned tables — and propose an ordered plan. Deletion itself should be a deliberate, backed-up step you approve category by category.
Deleting old revisions is generally safe; keeping the last few per post is the sensible default. Set WP_POST_REVISIONS so the problem does not recur.
They are good at executing the mechanical deletions. The agent's contribution is the judgement layer — what exists, where it came from, what is safe, in what order.
Sometimes modestly. Bloat mainly affects backups, migrations and admin queries. If you are chasing front-end speed, caching and images matter far more.
A verified backup. Database cleanup is the one job where you must know the undo works before you begin.