To fix wp_options autoloaded data bloat in WordPress: Measure total footprint via wp option list --autoload=on --format=total_bytes, pinpoint oversized entries piped to sort -n -k 2, disable global loading on non-essential active options with wp option set-autoload <key> off, purge stale transients using wp transient delete --expired, and confirm the autoload column is indexed.[1][2]
Follow this production diagnostic runbook to clear the WordPress 6.6+ Site Health 800 KB critical alert, eliminate MariaDB buffer pool thrashing, and lower dynamic Time to First Byte (TTFB) across PHP-FPM and LiteSpeed workers.[1]
Diagnosing wp_options Autoloaded Data Bloat and WordPress 6.6+ Thresholds
On every uncached WordPress request—including frontend views, /wp-admin/ screens, admin-ajax.php calls, and REST API routes—core executes wp_load_alloptions() before rendering any template. That function queries wp_options for every row flagged as autoloaded and deserializes the payload into PHP process memory.[1]
When orphaned plugin settings, uncleaned directory size caches, or stale transients push that payload past several megabytes, PHP workers burn CPU cycles deserializing unused arrays on every hit while MariaDB transfers redundant megabytes over local sockets.
Why does WordPress Site Health warn about autoloaded options above 800 KB?
Beginning in WordPress 6.6 (Trac changeset [57920] and ticket #61276), Site Health explicitly flags a critical performance warning reading “Autoloaded options could affect performance” whenever combined autoloaded bytes exceed 800 KB (800,000 bytes).[1] Keeping total autoloaded options well below 500 KB ensures minimal memory overhead per PHP worker and rapid serialization.
Which autoload values does WordPress query on every page load?
Legacy SQL cleanup guides frequently filter strictly by WHERE autoload = 'yes', missing millions of bytes inserted under newer core states. WordPress 6.6 modified the third $autoload parameter of add_option() and update_option() from 'yes' to null and introduced dynamic thresholds evaluated by wp_autoload_values_to_autoload().[1]
Database autoload Value |
WordPress API Assignment | Loaded on Every Request? | Behavioral Summary |
|---|---|---|---|
yes |
Legacy default (true pre-6.6) |
Yes | Backward-compatible equivalent to on; fetched by wp_load_alloptions(). |
on |
Explicit true |
Yes | Explicitly marked as mandatory on every page request.[1] |
auto-on |
null (default) under 150 KB |
Yes | Dynamically evaluated below 150000 bytes and enabled.[1] |
auto |
Added without explicit value | Yes | Relies on default WordPress behavior; currently autoloaded.[1] |
no |
Legacy explicit false |
No | Backward-compatible equivalent to off; queried only when requested. |
off |
Explicit false |
No | Explicitly excluded from global load (e.g., admin-only settings).[1] |
auto-off |
null above 150000 bytes |
No | Dynamically suppressed because option value exceeded 150 KB.[1] |
Step-by-Step Terminal Runbook to Fix wp_options Autoload Bloat
Always capture an immediate logical snapshot before altering production database rows using WP-CLI or MariaDB client commands.
Step 1: Create a Backup and Measure Total Autoload Footprint
Run these commands inside your WordPress document root via SSH:
# 1. Export a restorable SQL snapshot prior to changes
wp db export wp_options_backup_$(date +%F_%H%M).sql
# 2. Check exact combined size of active autoloaded rows in bytes
wp option list --autoload=on --format=total_bytes
Note that --autoload=on in WP-CLI captures all rows matching active autoload semantics defined in core (yes, on, auto-on, auto).[2]
Step 2: Identify the Top Largest Autoloaded Keys
Remember that wp option list --orderby strictly accepts option_id, option_name, or option_value. Pipe wp option list output through POSIX sort on the size_bytes column to rank top offenders accurately:[2]
# Rank the top 20 largest autoloaded entries by byte size
wp option list --autoload=on --fields=option_name,autoload,size_bytes | sort -rn -k 3 | head -n 20
Alternatively, execute the equivalent read-only audit directly inside MariaDB or MySQL:
SELECT
option_name,
autoload,
ROUND(LENGTH(option_value) / 1024, 2) AS size_kb
FROM wp_options
WHERE autoload IN ('yes', 'on', 'auto-on', 'auto')
ORDER BY LENGTH(option_value) DESC
LIMIT 20;
Step 3: Is it safe to delete rows from wp_options or set autoload to off?
Choose between switching autoload off or deleting the row based on whether the owning component remains active on your site:
- Active Plugins & Themes (
set-autoload off): Never delete serialized configurations for currently active SEO suites, e-commerce plugins, or builders. Disable global autoloading so WordPress fetches the option on demand only when the plugin callsget_option():[3]
# Keep option data intact, stop loading it on every HTTP request
wp option set-autoload rewrite_rules_backup off
wp option set-autoload active_plugin_heavy_cache off
(Acceptable WP-CLI values for wp option set-autoload are 'on', 'off', 'yes', and 'no'.)[3]
- Decommissioned Plugins (
delete): If an oversized option (wpseo_old_logs, uninstalled page builder caches, removed security scanners) belongs to software removed fromwp-content/plugins/, delete the orphaned key:
# Permanently drop orphaned option left by an uninstalled plugin
wp option delete orphaned_legacy_plugin_settings
Do Not Disable Critical Core Options: Never switch siteurl, home, active_plugins, template, stylesheet, rewrite_rules, or wp_user_roles to off. Suppressing autoload on core bootstrap options forces repetitive uncached queries across every request and breaks admin routing.
Step 4: Purge Expired and Stuck Transients
When Redis or Memcached disconnects, or when plugins create transients without expiration callbacks, thousands of _transient_* rows accumulate in wp_options. Clear expired records cleanly with WP-CLI:[4]
# Safely remove all expired single-site and network transients
wp transient delete --expired
Inspect remaining transient counts and byte footprint inside wp_options:
# Measure remaining autoloaded transients
wp option list --search="*_transient_*" --autoload=on --fields=option_name,size_bytes | sort -rn -k 2 | head -n 15
WordPress 6.6+ Autoload Filters and Threshold Tuning
How do I stop WordPress plugins from autoloading options above 150 KB?
Core enforces a default 150000-byte (150 KB) cap through the wp_max_autoloaded_option_size filter for options inserted with default (null) autoload arguments.[1] Third-party plugins explicitly passing true or 'yes' bypass that cap, while tightening the cap for implicit calls via a mu-plugin prevents future bloat.
Drop the following snippet into wp-content/mu-plugins/strict-autoload-guard.php to reduce the dynamic autoload cutoff from 150000 bytes to 50000 bytes (50 KB):[1]
<?php
/**
* Plugin Name: Strict Autoload Threshold Guard
*/
add_filter( 'wp_max_autoloaded_option_size', static function () {
return 50000; // Lower dynamic cap from 150 KB to 50 KB
} );
Explicit Option Auditing with Performance Lab: For live visibility inside the WordPress dashboard without SSH access, temporarily enable the official WordPress Performance Team's Performance Lab plugin. It extends the built-in Site Health autoload diagnostic to render per-option sizes and source attribution directly in /wp-admin/site-health.php.[1]
MariaDB Index Tuning and Object Cache Verification
Even after cutting autoloaded rows down below 500 KB, older WordPress installations (or sites migrated from pre-indexed MyISAM schemas) may suffer full-table scans on wp_options whenever wp_load_alloptions() queries WHERE autoload IN (...).
Verify Composite Key Coverage and Table Fragmentation
Connect to MariaDB and confirm an index exists on the autoload column:
SHOW INDEX FROM wp_options WHERE Column_name = 'autoload';
If SHOW INDEX returns an empty result set, create a dedicated index on autoload and reclaim fragmented InnoDB pages freed by large row deletions:
-- Add missing index on autoload column (safe online DDL on InnoDB)
ALTER TABLE wp_options ADD INDEX autoload (autoload);
-- Rebuild InnoDB table space to reclaim deleted transient pages
OPTIMIZE TABLE wp_options;
Confirm Object Cache Offloading (alloptions Hash)
On high-concurrency WooCommerce or publishing clusters, pairing clean database tables with an in-memory object cache (Redis or Memcached) prevents wp_load_alloptions() from hitting MariaDB on subsequent requests. Check object cache hit rates via WP-CLI:
# Confirm persistent object cache drop-in status
wp cache type
High-traffic WooCommerce catalogs and concurrent WordPress workloads require isolated NVMe database I/O and dedicated CPU threads so database locks never bottleneck checkout latency. Scale high-concurrency stores on enterprise bare metal via Dedicated Servers or low-latency Dedicated Servers in Pakistan.
Post-Cleanup Verification Checklist
- Confirm
wp option list --autoload=on --format=total_bytesreports well under800000bytes (target< 400000).[1][2] - Flush persistent object cache keys (
wp cache flush) so stale serializedalloptionsarrays are evicted from Redis/Memcached memory. - Verify Tools > Site Health confirms the critical “Autoloaded options could affect performance” warning is resolved.[1]
- Inspect
curl -o /dev/null -s -w "TTFB: %{time_starttransfer}s\n" https://yourdomain.com/to confirm dynamic response latency improvement.
Eliminate WordPress Database Latency on Dedicated NVMe Hardware
Stop sharing MariaDB IOPS and CPU cores on congested shared plans. Upgrade to bare-metal NVMe infrastructure engineered for sub-second WordPress and WooCommerce TTFB.
Explore Dedicated Servers PakistanDisclaimer: This post is for informational and educational purposes only, accurate to the best of our knowledge at publication. It does not constitute advice. We do not guarantee accuracy or completeness and accept no liability for any decisions or losses resulting from reliance on this content. Always verify database backups before running write queries.
Sources & Official References
- WordPress Core Engineering Team. "Options API: Disabling autoload for large options (Changeset [57920] & Ticket #61276)." Make WordPress Core, June 18, 2024. Available at: https://make.wordpress.org/core/2024/06/18/options-api-disabling-autoload-for-large-options/
- WordPress CLI Handbook. "wp option list — Command Reference & Available Fields." WordPress Developer Resources. Available at: https://developer.wordpress.org/cli/commands/option/list/
- WordPress CLI Handbook. "wp option set-autoload — Sets the autoload value for an option." WordPress Developer Resources. Available at: https://developer.wordpress.org/cli/commands/option/set-autoload/
- WordPress CLI Handbook. "wp transient delete — Deletes expired or named transients." WordPress Developer Resources. Available at: https://developer.wordpress.org/cli/commands/transient/delete/
