brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: wp option list --autoload=on --format=total_bytes shows what every page load drags along

Performance
~/tips/tip-wordpress-autoload-options-size

wp option list --autoload=on --format=total_bytes

Shows how many bytes of WordPress options load on every page request, and which ones are biggest.

Some options in the WordPress database load on every single request. If plugins leave big ones behind, that is a permanent tax.

The autoload flag in the options table decides which values WordPress loads in one go at startup. The total size of those matters. WP-CLI can add it up.

wp option list --autoload=on --format=total_bytes

You get one number in bytes. The docs show an example with a result around 33,000. To see who is responsible, list names with sizes and sort them:

wp option list --autoload=on --fields=option_name,size_bytes | sort -n -k 2 | tail

The biggest ones are at the bottom. Names often point at the plugin that owns them, including plugins you removed long ago.

The caveat: do not delete options just because they are large. Some are serialized settings that a plugin needs. I would use this as a list of suspects, search for the plugin that writes each one, and only then decide. Export the database first, and test wp option delete on a copy of the site.

I run this kind of check before I blame the hosting. A heavy autoload set is cheap to find and sometimes explains why every page feels the same slow.

Further reading: wp option list (WP-CLI command reference), On this site: wp transient delete –expired cleans the leftovers out of your options table, On this site: –skip-plugins and –skip-themes get WP-CLI working on a broken site

More Performance tips EXPLAIN (SETTINGS) SELECT * FROM my_table WHERE id = 42; sudo apt install hyperfine sudo apt install fio dtparam=fan_temp0=55000 sudo cpufreq-set -g powersave All Performance tips (9) All topics

Link