Skip to content

Expired transients in WordPress

Transients are temporary data that WordPress and plugins keep for a while to save work: the result of a slow query, the answer from another service, a list that takes long to build. Each transient has an expiry time. Once it has passed, the transient is expired and gets built again the next time it’s needed.

Transients make a site faster as long as they’re reused. Expired ones no longer help, but without an object cache, they sit in the options table of the database until they’re cleaned up. Some are always there. Large numbers make the options table larger and some queries on it slower.

There’s a related trap: transients stored without an expiry time are loaded on every request, as part of the autoloaded options.

WordPress: The most common cause of many expired transients is a plugin that creates a new transient for every visitor, every search or every page, under a new name each time, so they are never read again. WordPress deletes expired transients once a day through WP-Cron. When scheduled tasks don’t run reliably, they pile up.

Cache: With a persistent object cache, transients are kept in memory instead of in the database. They expire there and don’t show up in the database at all.

The Expired transients card is in System info, tab Database, under Cleanup potential. It counts the transients in the options table whose expiry time has passed. The number gives context; Permo doesn’t rate it and deletes nothing.

With a persistent object cache, the card shows a dash and Kept in the object cache, not in the database: there’s nothing to count in the database.

Sources