WordPress

Autoload

Autoload is the flag on a wp_options row that tells WordPress to read it into memory at the start of every request. Whatever you mark autoload costs time on every page, including pages that never use the setting.

How it is measured

WordPress runs one query, roughly SELECT option_name, option_value FROM wp_options WHERE autoload IN ('yes', 'on', ...), and caches the result as the alloptions array. Measure the weight with SELECT SUM(LENGTH(option_value)) FROM wp_options WHERE autoload = 'yes' (newer versions use 'on' and related values), in bytes.

Site Health under Tools warns about autoloaded options once the total passes about 800 KB. WP-CLI gives the same view with wp option list --autoload=on --fields=option_name,size_bytes --orderby=size_bytes.

Worked example

A membership site on shared hosting shows a 1.1 second time to first byte on pages with no queries of their own. The autoload total is 3.4 MB. Nearly 2.2 MB of it is one option named _lite_cache_blob from a plugin the owner removed in 2021, still sitting there with autoload on.

Setting that row to autoload = 'no' brings the total to 1.2 MB and the TTFB to about 640 ms. Deleting the row after a database backup frees the rest.

How it differs

Autoload is a column, wp_options is the table that holds it. Not every option in the table is autoloaded, and a large row with autoload off costs nothing until code asks for it by name. Object cache can hide the cost on repeat requests by keeping alloptions in Redis, but the first request after a flush still pays.

Common errors

Reading the table row count instead of the autoload byte total. Deleting unfamiliar option names without a backup and breaking a plugin that was dormant. Storing a transient-like cache in a permanent option with autoload on. Assuming deactivating a plugin removes its options, when many leave them in place. Adding an object cache and never checking whether alloptions is the thing that was big.

In practice

Run the sum query this week and write down the number. If it is above 800 KB, list the ten largest autoloaded rows, match each to an active plugin, and switch the leftovers from dead plugins to autoload off before you delete anything. Re-check TTFB on an uncached page afterwards.

See also

wp_options, Object cache

Sources

Count this on a real site.

Watch my website