Black FridayCyber Monday 2026
15Days
02Hrs
46Mins
46Secs
Flat20% OFF

Our biggest sale of the year20% off the first payment on all maintenance plans. Code BF2026

Grab the deal
WordPress

WordPress Database Cleanup: Autoloaded Options, Transients and Revisions

A bloated database can slow the admin and every page load. Learn to measure autoloaded options, clear transients and revisions safely and test the result.

wpallsolution 6 min read

A WordPress database cleanup removes data your site no longer needs, such as expired temporary values, old revisions and leftovers of plugins you deleted. A very large or messy database can make the admin slow and add work to every page load, mostly through “autoloaded” options that WordPress reads on each request. This guide shows how to measure first, back up, and clean the safe areas in a careful order, without deleting things you do not understand.

Quick answer

Take a tested backup, then measure: Site Health reports the autoloaded options size and warns above a default threshold of 800,000 bytes, and WP-CLI can list the largest ones. Review large autoloaded options and find out which plugin owns them; delete only expired transients, limit post revisions and empty old trash; optimise tables if your host allows. Compare the result with your measurements. Do not run a cleanup plugin blindly on a live site, because it can delete data you still need.

How this guide was prepared: it is research-based. We read the WordPress source code and the WP-CLI documentation listed under Sources, checked on October 23, 2026. We did not clean your database, and the speed benefit varies a lot by site, so we promise no figures.

What is in the database

WordPress keeps posts, comments, users and settings in a database. Three areas often grow. Options hold settings, and options marked as autoloaded are loaded on every request. The WordPress source says autoloaded options are configuration settings for plugins and themes that are loaded with every page load, and its Site Health test (added in WordPress 6.6) turns critical when the total size passes 800,000 bytes by default. Transients are temporary cached values with an expiry time. Revisions are saved versions of posts; the constant WP_POST_REVISIONS can limit them, and trashed items are removed after the number of days set by EMPTY_TRASH_DAYS, which WordPress defaults to 30.

The decision tree: what should you clean first?

Flowchart for a safe WordPress database cleanup: five questions about backups, autoloaded options, transients, revisions and results
Five questions keep a database cleanup safe.
  1. No tested backup? Make one first (Step 1).
  2. Site Health warns about autoloaded options? Find the largest ones (Step 3).
  3. Many expired transients? Delete expired ones only (Step 4).
  4. Hundreds of revisions per post? Limit them, then clean old ones (Step 5).
  5. Something broke or got slower? Restore and investigate (Step 6).

6 steps for a safe WordPress database cleanup

Step 1: Back up and test the backup

Deleted rows cannot be undone, so take a full database backup and make sure you can restore it, ideally on a staging copy first. See is your WordPress backup really safe, and note the time so you can compare before and after.

Step 2: Measure what you have

Open Tools → Site Health and read any message about autoloaded options. Your host’s database tool shows the size of each table. With WP-CLI, wp option list --autoload=on --fields=option_name,size_bytes lists autoloaded options with their sizes (pipe it through sort to see the biggest). Write down the numbers, because you need them to know whether the cleanup helped. If the admin feels slow, also see WordPress slow after installing a plugin.

Step 3: Review autoloaded options

A large autoloaded option is not always bad: it may be a plugin’s real settings. Find the owner by the option name prefix, then decide: keep it, ask the plugin whether it can store the data differently, or, if the plugin is gone, remove its leftover option after confirming it is not used. Never delete options you cannot identify. Changing an option to not autoload is also possible but is best done by someone who knows how the plugin reads it, because it can slow a page that needs it.

Step 4: Delete expired transients

Transients with an expiry time are safe to remove once they have expired. WP-CLI offers wp transient delete --expired. Do not delete transients that are still valid just to reduce row counts, because the plugin will rebuild them and may slow the next request. If you use a persistent object cache, transients may live there instead of in the database.

Step 5: Limit revisions and empty old trash

Revisions help you roll back, but hundreds per post add weight. You can cap them by setting WP_POST_REVISIONS in wp-config.php to a number such as 10, which affects future revisions; old ones remain until deleted. Trashed posts, pages and comments are removed after the EMPTY_TRASH_DAYS period, 30 days by default. Delete old revisions only after your backup, and keep the recent ones for content you are still editing.

Step 6: Optimise tables, then measure again

After deleting rows, a table can still occupy extra space. Your host’s database tool or wp db optimize can reclaim it, if your host allows that. Then repeat the measurements from Step 2, compare page and admin speed, and test your forms, search and any store flows. If anything broke, restore the backup and clean in smaller steps. See also Largest Contentful Paint in WordPress for page speed beyond the database.

Version and hosting differences

  • The Site Health autoloaded options check exists from WordPress 6.6 onward.
  • Some hosts limit database tools or disable table optimisation.
  • Stores and membership sites keep valuable data in options and tables; treat them with extra care.

How to verify the cleanup

  • The autoloaded size or table sizes dropped, according to your notes.
  • The admin and key pages feel the same or faster.
  • Forms, search, login and checkout still work.

How to prevent database bloat

  • Delete unused plugins properly, so their data does not linger.
  • Cap revisions and keep the trash period reasonable.
  • Check Site Health regularly; see WordPress Site Health.
  • Include database checks in your maintenance routine.

Frequently asked questions

Is a database cleanup plugin safe?

It can be, but it may delete data you need. Back up first and review what it will remove.

Will cleanup make my site faster?

Sometimes. The effect depends on what was bloated. Measure before and after.

What are autoloaded options?

Settings WordPress loads on every request. If they grow too large, every page pays the cost.

Can I delete all revisions?

You can, after a backup, but you lose the ability to roll back older edits.

What to do next

Back up, measure, and clean the safe areas first. If you would like help auditing your database, wpallsolution offers WordPress maintenance packages, including speed work in the higher tiers. We cannot promise a speed result.

Sources and official documentation

Keep reading

More guides

Need a hand with this?

Tell us what is happening. We reply with honest next steps.

Talk to us