WordPress Transient API Can Silently Bloat Your Database Over Time
WordPress's transient API lets developers temporarily cache data such as API responses and query results using a set of core PHP functions, with expiration times measured in seconds. On most sites, transients are stored in the wp_options database table, and expired entries are only cleaned up passively when a read attempt detects they have lapsed. Because cleanup relies on both active reads and WP-Cron — which only triggers on page visits — low-traffic sites can accumulate thousands of stale rows that load into memory on every page request. WP-CLI's 'wp transient delete --expired' command offers a safe way to remove only lapsed entries without disrupting live cache data, while the '--all' flag clears everything and may cause a brief performance hit as plugins refetch data. Understanding the difference between these options is essential before running any manual cleanup on a production WordPress site.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in