On every request, WordPress loads all options marked autoload from the wp_options table into memory, before anything else happens. When plugins pile megabytes of data in there (logs, caches, settings of long-uninstalled plugins), every page load gets slower, PHP memory usage climbs, and the object cache struggles. Checking and trimming autoloaded options is one of the most effective WordPress backend optimisations.

How big is your autoload?

With WP-CLI (from the WordPress root):

wp db query "SELECT ROUND(SUM(LENGTH(option_value))/1024) AS autoload_kb, COUNT(*) AS options FROM $(wp db prefix)options WHERE autoload IN ('yes','on','auto-on','auto');"

Or in SQL, adjusting the table prefix:

SELECT ROUND(SUM(LENGTH(option_value))/1024) AS autoload_kb, COUNT(*) AS options
FROM wp_options
WHERE autoload IN ('yes','on','auto-on','auto');

WordPress 6.6+ uses new autoload values (on, off, auto, auto-on, auto-off) besides the classic yes/no. The query covers both.

Rough guide:

Autoload size Status
< 500 KB Fine
500 KB – 1 MB Worth a look
> 1 MB Likely slowing the site. WordPress Site Health warns above about 800 KB
Several MB Definitely fix

See WP-CLI.

Find the largest autoloaded options

SELECT option_name, ROUND(LENGTH(option_value)/1024) AS kb, autoload
FROM wp_options
WHERE autoload IN ('yes','on','auto-on','auto')
ORDER BY LENGTH(option_value) DESC
LIMIT 25;

Option names usually reveal their source: prefixes like wpseo_, elementor_, woocommerce_, _transient_, rs_ (Revolution Slider) and so on.

Typical culprits

  • Leftovers from deleted plugins: many plugins don’t clean up their options on uninstall.
  • Transients (_transient_…, _site_transient_…) stored with autoload, especially when no persistent object cache is installed.
  • Plugins storing logs, statistics or caches in options (some security, SEO and analytics plugins).
  • Page builder or theme option blobs that grew large over time.

Fix it, safely

Back up the database first:

wp db export ~/wp-before-autoload-$(date +%F).sql

See mysqldump.

1. Remove options of plugins you no longer use. Confirm the plugin is truly gone (not just deactivated), then:

wp option delete old_plugin_settings

Or delete all options with that plugin’s prefix:

DELETE FROM wp_options WHERE option_name LIKE 'oldplugin\_%';

Be precise with prefixes. A too-broad LIKE deletes things you need.

2. Turn off autoload for large options that aren’t needed on every page. Data used only in the admin, or on specific pages, doesn’t need autoloading:

wp option set-autoload big_option_name off       # WP-CLI 2.10+ on WordPress 6.6+
# older:
wp db query "UPDATE wp_options SET autoload='no' WHERE option_name='big_option_name';"

The option still loads when the plugin requests it, just not on every request.

3. Clean up transients:

wp transient delete --expired
wp transient delete --all        # safe in general: transients are regenerated, though the first page loads may be slower

4. Ask the plugin vendor. If an active plugin keeps a huge autoloaded option, report it. There may be a setting to store logs elsewhere, or an update that fixes it.

Re-run the size query afterwards. Then test the site, especially the admin, forms and checkout.

Prevent it from growing back

  • Use a persistent object cache (Redis). Transients are then stored in Redis instead of wp_options. See WordPress Redis object cache.
  • Delete plugins you don’t need. Don’t just deactivate them.
  • Check autoload size after installing new plugins, and periodically (Site Health → Info, or the query above).
  • Prefer plugins that clean up after themselves (check reviews and code).
  • Post revisions: limit them with define('WP_POST_REVISIONS', 10); in wp-config.php, and clean old ones with WP-CLI or a cleanup plugin.
  • Orphaned postmeta and expired sessions (WooCommerce): a periodic cleanup helps.
  • Indexes: large sites benefit from making sure wp_options has an index on autoload. Recent WordPress versions handle this.
  • Slow queries: use the MySQL slow query log, or Query Monitor, to see what’s actually slow. See MySQL slow query log.

Quick reference

Task Command
Autoload size SELECT SUM(LENGTH(option_value)) FROM wp_options WHERE autoload IN ('yes','on','auto-on','auto')
Largest options ORDER BY LENGTH(option_value) DESC LIMIT 25
Delete option wp option delete NAME
Disable autoload wp option set-autoload NAME off
Expired transients wp transient delete --expired
Back up first wp db export file.sql

Related: WordPress memory limit and WordPress cache plugins.

  • WordPress
  • Performance
  • MySQL