← All posts

WordPress slow on every page? Check your autoloaded options

Every WordPress request loads all options flagged for autoload in one go. When removed plugins leave their data behind, the whole site pays for it. How to find the heavy rows and clean them up safely.

WordPress slow on every page? Check your autoloaded options

Key points

  • WordPress loads every autoloaded option on every request, admin and REST API included.
  • Uninstalled plugins often leave large options behind.
  • Turn autoload off before deleting anything: it is reversible and safe.

When a WordPress site feels slow everywhere — even on a near-empty page, even in the dashboard where page caching does nothing — one of the first places we look is wp_options. On boot, WordPress pulls every option flagged for autoload in a single query and keeps it in memory. If a few megabytes of forgotten data live there, every request carries them.

Find the heaviest rows

Since WordPress 6.6, Site Health warns when autoloaded options get too large. To see what is inside, run this query (adjust the table prefix):

SELECT option_name, LENGTH(option_value) AS size, autoload
FROM wp_options
WHERE autoload IN ('yes', 'on', 'auto', 'auto-on')
ORDER BY size DESC
LIMIT 20;

Those values are deliberate: WordPress 6.6 introduced on, off, auto, auto-on and auto-off, while older sites still carry legacy yes and no. With WP-CLI, wp option list --autoload=on --format=total_bytes gives you the total.

Work out who owns each option

The option name nearly always gives its origin away: the prefix matches a plugin or the theme. On sites we inherit, the same culprits show up again and again:

  • Settings from plugins removed years ago, which their uninstall routine never cleaned.
  • Logs or stats kept in a single option that grows on every visit.
  • Transients with no expiry, which are autoloaded by default.
  • CSS or layout caches generated by a page builder nobody uses any more.

Before changing anything, search the codebase for the option name (grep -r "option_name" wp-content). If nothing references it, its plugin is gone.

Clean up without breaking things

Back up the database first, then go in two steps. Switch autoload off for the suspicious options and watch the site for a few days:

wp option set-autoload old_plugin_cache off

// or in PHP, since WordPress 6.4
wp_set_option_autoload('old_plugin_cache', false);

The option is still readable: if something needs it, WordPress just runs one extra query. Once you are sure it is orphaned, remove it with wp option delete. For expired transients, wp transient delete --expired does the job.

Keep it from coming back

In your own code, pass the autoload argument explicitly: update_option('wts_report', $data, false) for anything large or rarely read. A persistent object cache such as Redis lowers the cost of the query but does not fix the root cause — the full set still lands in memory on every page. We check this as part of our monthly maintenance.

FAQ

What size is acceptable?

There is no magic number; WordPress applies its own threshold in Site Health. What matters in practice is spotting options that should not be there at all, whatever their size.

Can a cleanup plugin do this for me?

Yes, as long as you review what it wants to delete. Some options without an obvious prefix belong to the theme or WooCommerce and are essential.

Site getting slower for no obvious reason? Our WordPress maintenance plans include this kind of database audit.

Share LinkedIn Facebook X WhatsApp
</>

webtestudio

Web agency: custom WordPress sites, premium themes and SaaS software.

Discuss your project →