Transient
A transient is a piece of data that WordPress or a plugin stores under a name for a limited time, so it does not have to be worked out again. Without a persistent object cache, transients are rows in the options table. With one, they live in the cache.
- By
- WP Ministry
- Published
In short
- A transient is a stored value with an expiry time. Deleting one is safe, because the code that set it has to cope with it being gone.
- Where transients are kept depends on the site. It is the options table by default, and the object cache when a persistent one is in use.
- Expired transients can build up in the options table. WordPress clears them infrequently, and you can clear them yourself.
WordPress's glossary defines a transient as "temporal data identified by a custom name, stored in the web server database or memory for fast access." In practice a plugin does something slow, such as asking another server a question or running a heavy database query, and saves the answer for a set time. Until that time is up it reads the saved copy. WordPress does this itself: its hosting handbook says core uses transients for its calls to WordPress.org about updates and events.
The time is a limit, not a promise. WordPress's documentation puts it this way: "transient expiration times are a maximum time. There is no minimum age." A transient can vanish early, and the code that set it has to be able to build it again.
A transient is the smallest of a site's caches: one named value. The object cache is the store WordPress keeps such values in while it works, and a persistent one becomes the home of every transient. A page cache stores whole finished pages, OPcache stores compiled PHP code, and a CDN stores copies of files outside your server. None of those three holds transients.
Where you meet it
- The options table. Without a persistent object cache, a transient named
exampleis a row named_transient_example. If it expires, a second row,_transient_timeout_example, holds the time. Names that begin_site_transient_are the network-wide kind. - Autoloaded options. WordPress's reference says a transient with no expiry time is autoloaded, which means it is read on every page WordPress builds. One with an expiry time is not.
- Nowhere in the database. With a persistent object cache, transients are kept in the cache. WordPress's documentation says they "should also never be assumed to be in the database".
- WooCommerce. Under WooCommerce, then Status, then Tools, two tools clear them: "WooCommerce transients" and "Expired transients".
How to look at yours
wp transient typeThe answer is Transients are saved to the database. or Transients are saved to the object cache.
What goes wrong
- Expired transients build up. The documentation says WordPress "infrequently cleans out expired transients", so on a site without a persistent object cache they can sit in the options table as dead rows.
wp transient delete --expiredremoves them. How to clean up a WordPress database shows where that job belongs in a cleanup. - A transient with no expiry time rides along on every page. It adds to what WordPress's documentation calls the autoload footprint, the data loaded on every request. How to find the cause of a slow WordPress admin shows how to measure the autoloaded options.
- Old data is shown. A transient goes on giving the saved answer until it expires or is deleted. On a store, product data that looks out of date is what the "WooCommerce transients" tool is for. Why the WooCommerce dashboard is slow covers both tools.
Common questions
Is it safe to delete transients?
Yes. A transient is a copy of something that can be worked out again, and WordPress's documentation tells developers to write code that copes when one is missing. Each one has to be built again the next time it is needed, so deleting them does not speed a site up.
Why are there no transients in my database?
The site has a persistent object cache, so transients are kept there. wp transient delete --all then removes only those left in the database, and WP-CLI says so: "You must flush the cache to delete all transients."
What is the difference between a transient and an option?
An option is a setting meant to stay until someone changes it. A transient works the same way but has an expiry time, and it may be kept outside the database. WordPress's documentation says to use transients for any data that is expected to expire.

