Skip to content
    Other

    How to Find and Fix Bloated Autoloaded Options in WordPress

    Large autoloaded options in wp_options slow every page and admin screen. Here is how to find the worst offenders with Site Health and WP-CLI, and fix them safely.

    6 min readGus, MaintainHQ

    Database table with a few oversized rows highlighted next to a WordPress logo

    Autoloaded options are settings WordPress loads from the wp_options table on every request. When plugins leave large or unused data there, every page and admin screen pays the cost. You can find the culprits with Site Health and a few WP-CLI commands, then delete them or turn autoload off, with a backup taken first.

    What are autoloaded options in WordPress?

    They are rows in the wp_options table that WordPress fetches in a single query early in every request, whether or not the page needs them. This avoids lots of small queries for settings that are used constantly, such as the site URL or the active theme.

    The trouble is that any plugin can add an option and mark it to autoload. Over years of installing, testing and removing plugins, that one query can grow to include stored logs, cached API responses and settings for plugins that are long gone.

    Since WordPress 6.6, the autoload column can hold values such as on, off, auto, auto-on and auto-off, as well as the older yes and no. The ones WordPress loads automatically are yes, on, auto-on and auto.

    How do you know if autoloaded options are slowing your site?

    Start with Tools > Site Health. Recent WordPress versions include a performance test that warns when the total size of autoloaded options is large enough to affect performance. It also reports how many options are autoloaded and their combined size.

    Other signs point the same way:

    • Uncached pages and the admin area feel slow even on a quiet site.
    • PHP memory use is higher than the site's content would suggest.
    • A persistent object cache such as Redis or Memcached behaves oddly, because WordPress caches all autoloaded options together under one key.

    Site Health gives you a yes or no. To see which options are responsible, you need to look at the table itself.

    How do you find the biggest autoloaded options?

    Run these WP-CLI commands from the site's root directory. They only read data, so they are safe on a live site.

    1. Check the table prefix, since it is not always wp_:
      wp db prefix
      
    2. Measure the total size of autoloaded options (replace wp_ with your prefix):
      wp db query "SELECT COUNT(*) AS options, SUM(LENGTH(option_value)) AS bytes FROM wp_options WHERE autoload IN ('yes','on','auto-on','auto');"
      
    3. List the 20 largest:
      wp db query "SELECT option_name, LENGTH(option_value) AS bytes, autoload FROM wp_options WHERE autoload IN ('yes','on','auto-on','auto') ORDER BY bytes DESC LIMIT 20;"
      
    4. For each large option you do not recognise, find out what created it. Searching the codebase for the option name usually answers this:
      grep -rl "option_name_here" wp-content/
      

    If you do not have WP-CLI, you can run the same SQL in phpMyAdmin or Adminer from your hosting control panel.

    Which options are safe to remove or stop autoloading?

    It depends on who owns the option and whether that plugin is still active. Use this as a guide, and check each option before acting.

    What you findHow to recognise itUsual action
    Expired transientsNames starting _transient_ or _site_transient_Delete with WP-CLI
    Settings from a deleted plugingrep finds no matching code in wp-contentDelete the option
    Large data from an active plugin that is rarely neededLogs, stats or cached responses in one big rowTurn autoload off, or change the plugin's settings
    Core WordPress optionsNames like siteurl, active_plugins, cron, rewrite_rulesLeave alone
    Active plugin or theme settingsgrep finds the plugin that reads itLeave alone unless the plugin's author advises otherwise

    A large cron option is a special case. It usually means scheduled events are piling up, often from a plugin that schedules jobs without clearing them. Fix the cause rather than editing the option directly.

    How do you fix autoloaded options without breaking the site?

    Work in small steps, testing as you go, and keep a fresh backup to hand. Deleting an option that an active plugin depends on will reset its settings.

    1. Take a backup of the database. If anything goes wrong, you want a quick way back. See backups if you need a reliable routine.
    2. Clear expired transients:
      wp transient delete --expired
      
    3. Delete options left by removed plugins, one at a time:
      wp option delete option_name_here
      
    4. Stop autoloading large options that are still in use. Current WP-CLI includes a dedicated command:
      wp option set-autoload option_name_here off
      
      If your WP-CLI does not have it, the SQL equivalent works too:
      wp db query "UPDATE wp_options SET autoload='off' WHERE option_name='option_name_here';"
      
    5. Flush the object cache so the old list is not served from memory:
      wp cache flush
      
    6. Re-test. Re-run the size query, check Site Health, then click through the front end, the admin and any forms or checkout pages.

    If a plugin stops working after a change, restore that one option from your backup or reverse the autoload change. If the site errors out completely, our guide to fixing a broken site covers the next steps.

    How do you stop the bloat coming back?

    Most bloat comes from plugin churn, so the fix is mostly habit. A few checks keep the table tidy:

    • Delete plugins from the Plugins screen, not by removing folders. Deleting through WordPress gives the plugin a chance to run its uninstall routine. Some plugins keep their data on purpose, so check afterwards.
    • Try new plugins on staging first, so trial settings never reach the live database.
    • Review plugin settings that store logs or history. Many offer options to limit retention or store data elsewhere.
    • Re-run the size query every few months and after any big plugin clear-out.

    Adding this check to your WordPress maintenance checklist means it happens regularly rather than only when a client complains about speed. It sits alongside the other items in performance and security work.

    Wrapping up

    Autoloaded options are easy to overlook because nothing breaks; the site just gets a little slower with each plugin that leaves something behind. Measure first, identify each large option's owner, then delete or stop autoloading only what you understand. With a backup in place, the whole job takes minutes and keeps paying off.

    Frequently asked questions

    Is it safe to delete transients in WordPress?

    Yes, in normal circumstances. Transients are temporary cached data by design, and plugins should regenerate them when needed. Running wp transient delete --expired only removes ones that have already expired, which is the safest option. Deleting all transients is also generally safe, but expect slightly slower page loads briefly while plugins rebuild their caches.

    Will turning off autoload break a plugin?

    It should not. When an option is not autoloaded, WordPress fetches it with a separate query the first time a plugin asks for it. The plugin still gets its data, just slightly later. The main risk comes from deleting an option rather than changing its autoload setting, so change autoload first when you are unsure who uses an option.

    Do I need WP-CLI to clean up autoloaded options?

    No. WP-CLI is the quickest route, but you can run the same SQL queries in phpMyAdmin or Adminer, which most hosts provide. Remember to use your site's actual table prefix, which you can find in wp-config.php. Whichever tool you use, export a database backup before running any delete or update query.

    Does a persistent object cache fix autoload bloat?

    Not really. Redis or Memcached can save the database query, but WordPress still loads every autoloaded option into memory on each request. Very large autoloaded data can also cause problems for the cache itself, because WordPress stores all autoloaded options together under one cache key. Cleaning up the options table helps whether or not you use an object cache.

    Get MaintainHQ updates

    Enjoyed this? Get new posts, Gus skills and WordPress maintenance tips by email. Roughly once a month, and you can unsubscribe at any time.

    Ready to try MaintainHQ?

    From £29 a month for up to 2 sites. Every plan starts with a 14-day trial.