Title: Delete Expired Transients
Author: webaware
Published: <strong>27 July 2013</strong>
Last modified: 6 September 2026

---

Search plugins

![](https://ps.w.org/delete-expired-transients/assets/banner-772x250.png?rev=2590620)

![](https://ps.w.org/delete-expired-transients/assets/icon-256x256.png?rev=2590620)

# Delete Expired Transients

 By [webaware](https://profiles.wordpress.org/webaware/)

[Download](https://downloads.wordpress.org/plugin/delete-expired-transients.2.0.7.zip)

 * [Details](https://en-gb.wordpress.org/plugins/delete-expired-transients/#description)
 * [Reviews](https://en-gb.wordpress.org/plugins/delete-expired-transients/#reviews)
 *  [Installation](https://en-gb.wordpress.org/plugins/delete-expired-transients/#installation)
 * [Development](https://en-gb.wordpress.org/plugins/delete-expired-transients/#developers)

 [Support](https://wordpress.org/support/plugin/delete-expired-transients/)

## Description

Delete old, expired transients from the WordPress options table (`wp_options`), 
to prevent them from bloating your database and even slowing down your website.

Unless you are using an object cache (like memcached), WordPress stores transient
records in the options table. Many transients are given an expiration time, so in
theory they should disappear after some time. In practice, because old transients
are only deleted when requested again after they’ve expired, many transients stay
in the database. After a while, there can be thousands or even millions of expired
transients needlessly taking up space in your options table, depending on what your
plugins are doing.

Delete Expired Transients schedules a daily task to delete any expired transients
from the options table. It performs this operation with a single SQL query, and 
then runs a second query to find any orphaned expiration records and deletes them
too.

There are a few other plugins around that clean up expired transients. This one 
is written for fast performance, set-and-forget scheduled housekeeping, and maximum
compatibility. It uses the PHP time to determine whether transients are expired,
not the database time (which can be different). It does only one job, and it does
it well with the minimum of resources.

Now optimised for WordPress Multisite.

### Translations

Many thanks to the generous efforts of our translators:

 * English (en_CA) — [the English (Canadian) translation team](https://translate.wordpress.org/locale/en-ca/default/wp-plugins/delete-expired-transients)
 * English (en_GB) — [the English (British) translation team](https://translate.wordpress.org/locale/en-gb/default/wp-plugins/delete-expired-transients)
 * English (en_ZA) — [the English (South African) translation team](https://translate.wordpress.org/locale/en-za/default/wp-plugins/delete-expired-transients)
 * French (fr_FR) — [the French translation team](https://translate.wordpress.org/locale/fr/default/wp-plugins/delete-expired-transients)
 * Hungarian (hu_HU) — [the Hungarian translation team](https://translate.wordpress.org/locale/hu/default/wp-plugins/delete-expired-transients)
 * Norwegian: Bokmål (nb_NO) — [neonnero](https://www.neonnero.com/)
 * Norwegian: Nynorsk (nn_NO) — [neonnero](https://www.neonnero.com/)
 * Russian (ru_RU) — [the Russian translation team](https://translate.wordpress.org/locale/ru/default/wp-plugins/delete-expired-transients)
 * Spanish (es_ES) — [the Spanish translation team](https://translate.wordpress.org/locale/es/default/wp-plugins/delete-expired-transients)

If you’d like to help out by translating this plugin, please [sign up for an account and dig in](https://translate.wordpress.org/projects/wp-plugins/delete-expired-transients).

### Contributions

 * [Translate into your preferred language](https://translate.wordpress.org/projects/wp-plugins/delete-expired-transients)
 * [Fork me on GitHub](https://github.com/webaware/delete-expired-transients)

### Privacy

Delete Expired Transients does not collect any personally identifying information,
and does not set any cookies. It removes some old information from the database,
potentially reducing a website’s exposure to leakage of personally identifying information.

## Screenshots

[⌊Tools page for manually deleting transients⌉⌊Tools page for manually deleting 
transients⌉[

Tools page for manually deleting transients

[⌊Multisite network admin page for manually deleting transients⌉⌊Multisite network
admin page for manually deleting transients⌉[

Multisite network admin page for manually deleting transients

## Installation

 1. Upload this plugin to your /wp-content/plugins/ directory.
 2. Activate the plugin through the ‘Plugins’ menu in WordPress.

That’s it! Expired transients will be deleted the next time you visit your website,
and then again once every day after that.

## FAQ

### What is a “transient” anyway?

According to the [Codex](https://codex.wordpress.org/Transients_API), transients
are:

> a simple and standardised way of storing cached data in the database temporarily
> by giving it a custom name and a timeframe after which it will expire and be deleted.

NB: by default they are stored in the database, but if you have an object cache 
like memcached they won’t be.

### Do I need this plugin?

Most websites don’t need this plugin. It all depends on what plugins are installed
and how they are being used. Some plugins make heavy use of transients to improve
website performance, and that can lead to a build up of old transient records in
the database. If your wp_options table is growing and causing problems with website
performance or backups, this plugin can help you by keeping transients under control.

### Why do transients build up, and fill up my wp_options table?

With the current way that the transients API works, expired transients are only 
deleted when they are accessed after their expiration date. When transients are 
user-specific or otherwise fairly unique, they can sit there in the database forever
unless some housekeeping task is run to clean them up. WordPress doesn’t currently
have such a housekeeping task. That’s what this plugin does.

### Will I lose any important data if I install this plugin?

Only if you have a plugin that is really badly written. Transients can be deleted
for a variety of reasons, because by definition they are considered ephemeral. They
are considered safe to delete at any time because they are supposedly only ever 
going to contain information that can be rebuilt.

There are some notable exceptions, e.g. some shopping carts store cart sessions 
in transients; this is obviously not information that can be easily rebuilt. That
data will only be deleted by this plugin if it has expired, which means it would
be deleted by WordPress anyway, so it is safe to use this plugin with shopping carts.

### How do I know it’s working?

On the Tools menu in the WordPress admin, you will find a screen for deleting transients.
It tells you how many expired transients there are in your database.

NB: after you install and activate this plugin, the first thing it does is schedule
a housekeeping task to delete expired transients. This means that there may not 
be any transients found when you visit this page in the tools menu straight after
installing the plugin, because they may have already been deleted. You probably 
never need to delete expired transients manually, because they’ll be automatically
deleted daily.

### Do I need this if I’m running an object cache?

No. Object caches like memcached are limited pools of data, and they already purge
old data periodically so that they can fit newer data. This means that old transients
will be removed from the cache automatically. It also means that new, fresh transients
can be removed at any time too, which is why you should never store anything in 
a transient that can’t be rebuilt easily. See this article on the WPEngine blog 
for more details: [A Technical Transients Treatise](https://wpengine.com/2013/02/wordpress-transient-api/).

### Can I change the schedule to run more often?

Not yet. I’ll consider adding a setting for that if it seems to be popular. I reckon
daily is often enough even for busy websites. When network activated on multisite,
it runs hourly to ensure it can get around all of the sites frequently enough.

### How does the plugin handle multisite?

If you activate it on individual sites within multisite, each site operates just
the same as a stand-alone website.

If you network activate the plugin, it operates differently. You get access to a
master admin screen that allows bulk deletion of transients across multiple blogs
in a network. This can also help you spot problem sites, by browsing through the
list of sites and seeing if any have large numbers of transients. You can find this
admin page under Settings on the multisite network admin.

The scheduled task also operates differently, batching up sites to clear expired
transients once every hour. The scheduled task can be initiated by activity on any
blog. Only 5 blogs are cleaned on each run, so up to 120 blogs will be cleaned each
day.

NB: if your website has multiple networks (e.g. if you’re running [WP Multi Network](https://wordpress.org/plugins/wp-multi-network/))
then you’ll need to network activate it on each network. Each activation only cleans
the blogs on that network, e.g. activating on example.com will clean blog.example.
com, images.example.com, shop.example.com, but not forum.example.net if that’s on
a separate network in the multisite.

### Useful SQL queries

Here’s a few useful SQL queries to run in MySQL when you are trying to debug what’s
happening with transients.

    ```
    -- transients that are not autoloaded (should be all with expiration times)
    select option_name, option_value
    from wp_options
    where option_name regexp '^(_site)?_transient_.*'
    and autoload='no'
    order by option_name;

    -- transient expirations
    select option_name, option_value, from_unixtime(option_value) as expiry_time
    from wp_options
    where option_name regexp '^(_site)?_transient_timeout_.*'
    order by option_value desc;

    -- transient expirations with paired transients (inc. orphans)
    select t1.option_name, t2.option_name, t1.option_value, from_unixtime(t1.option_value) as expiry_time
    from wp_options t1
    left join wp_options t2 on t2.option_name = replace(t1.option_name, '_timeout', '')
    where t1.option_name regexp '^(_site)?_transient_timeout_.*'
    order by t1.option_value desc;

    -- expired transient expirations with paired transients (inc. orphans)
    select t1.option_name, t2.option_name, t1.option_value, from_unixtime(t1.option_value) as expiry_time
    from wp_options t1
    left join wp_options t2 on t2.option_name = replace(t1.option_name, '_timeout', '')
    where t1.option_name regexp '^(_site)?_transient_timeout_.*'
    and t1.option_value < unix_timestamp()
    order by t1.option_value desc;
    ```

## Reviews

![](https://secure.gravatar.com/avatar/a1fff2650dcf0136136bbf4493cd8db7e2b244bfa6384cd05affe686a4a78a38?
s=60&d=retro&r=g)

### 󠀁[useful plugin](https://wordpress.org/support/topic/useful-plugin-948/)󠁿

 [ganohr](https://profiles.wordpress.org/ganohr/) 21 March 2023

easy to use. 簡単に利用できる。

![](https://secure.gravatar.com/avatar/2f0a379c9cadb3a683eb41f892f68983c22307747599dc0a2b8101fc87a519ad?
s=60&d=retro&r=g)

### 󠀁[works just fine](https://wordpress.org/support/topic/works-just-fine-121/)󠁿

 [wolkoff68](https://profiles.wordpress.org/wolkoff68/) 17 September 2018

Subj! 😉

![](https://secure.gravatar.com/avatar/a29bd6687c3b8671a547e1aca215593edab5e6563794fe481784d071e0e155ee?
s=60&d=retro&r=g)

### 󠀁[Still works great](https://wordpress.org/support/topic/still-works-great-30/)󠁿

 [G](https://profiles.wordpress.org/gnetworkau/) 13 August 2018

Still works great, perfect on Multisite…

![](https://secure.gravatar.com/avatar/f66cd8a5bb867bca499c23eca3b9d78639a112540c305b000a69471026afb91d?
s=60&d=retro&r=g)

### 󠀁[Simple and effective](https://wordpress.org/support/topic/simple-and-effective-776/)󠁿

 [Perrorist](https://profiles.wordpress.org/perrorist/) 24 August 2017

Just installed and left it to do its magic. After a while I checked the options 
table and sure enough almost all the transients had been deleted. Couldn't ask for
more.

![](https://secure.gravatar.com/avatar/1ada77f9edd966df7ea7a664c7636214ca31b4ff4925c3553d0698d7bc7d8338?
s=60&d=retro&r=g)

### 󠀁[Excellent plugin, amazing support](https://wordpress.org/support/topic/excellent-plugin-amazing-support-5/)󠁿

 [sojasoja](https://profiles.wordpress.org/sojasoja/) 19 May 2017

This is a great plugin, effective, simple and direct, plus great support, amazing
job!!!! Thank you!

![](https://secure.gravatar.com/avatar/f121b496ae07ea73610a170ba5de66e3b5fd9a0859042bfd16339c9079d08c12?
s=60&d=retro&r=g)

### 󠀁[Nice](https://wordpress.org/support/topic/nice-1454/)󠁿

 [SVTX](https://profiles.wordpress.org/svtx/) 4 January 2017

Very useful plugin! Thanks!

 [ Read all 13 reviews ](https://wordpress.org/support/plugin/delete-expired-transients/reviews/)

## Contributors and Developers

“Delete Expired Transients” is open source software. The following people have contributed
to this plugin.

Contributors

 *   [ webaware ](https://profiles.wordpress.org/webaware/)

“Delete Expired Transients” has been translated into 12 locales. Thank you to [the translators](https://translate.wordpress.org/projects/wp-plugins/delete-expired-transients/contributors)
for their contributions.

[Translate “Delete Expired Transients” into your language.](https://translate.wordpress.org/projects/wp-plugins/delete-expired-transients)

### Interested in development?

[Browse the code](https://plugins.trac.wordpress.org/browser/delete-expired-transients/),
check out the [SVN repository](https://plugins.svn.wordpress.org/delete-expired-transients/),
or subscribe to the [development log](https://plugins.trac.wordpress.org/log/delete-expired-transients/)
by [RSS](https://plugins.trac.wordpress.org/log/delete-expired-transients/?limit=100&mode=stop_on_copy&format=rss).

## Change Log

The full changelog can be found on [GitHub](https://github.com/webaware/delete-expired-transients/blob/master/changelog.md).
Recent entries:

### 2.0.7

Released 2018-11-19

 * tested: WordPress 5.0

## Meta

 *  Version **2.0.7**
 *  Last updated **1 month ago**
 *  Active installations **5,000+**
 *  WordPress version ** 3.7 or higher **
 *  Tested up to **7.1.3**
 *  PHP version ** 5.3 or higher **
 *  Languages
 * [English (Australia)](https://en-au.wordpress.org/plugins/delete-expired-transients/),
   [English (Canada)](https://en-ca.wordpress.org/plugins/delete-expired-transients/),
   [English (New Zealand)](https://en-nz.wordpress.org/plugins/delete-expired-transients/),
   [English (South Africa)](https://en-za.wordpress.org/plugins/delete-expired-transients/),
   [English (UK)](https://en-gb.wordpress.org/plugins/delete-expired-transients/),
   [English (US)](https://wordpress.org/plugins/delete-expired-transients/), [French (France)](https://fr.wordpress.org/plugins/delete-expired-transients/),
   [Italian](https://it.wordpress.org/plugins/delete-expired-transients/), [Norwegian (Bokmål)](https://nb.wordpress.org/plugins/delete-expired-transients/),
   [Portuguese (Brazil)](https://br.wordpress.org/plugins/delete-expired-transients/),
   [Russian](https://ru.wordpress.org/plugins/delete-expired-transients/), [Swedish](https://sv.wordpress.org/plugins/delete-expired-transients/)
   and [Turkish](https://tr.wordpress.org/plugins/delete-expired-transients/).
 *  [Translate into your language](https://translate.wordpress.org/projects/wp-plugins/delete-expired-transients)
 * Tags
 * [cache](https://en-gb.wordpress.org/plugins/tags/cache/)[expired](https://en-gb.wordpress.org/plugins/tags/expired/)
   [transient](https://en-gb.wordpress.org/plugins/tags/transient/)[transients](https://en-gb.wordpress.org/plugins/tags/transients/)
   [wp_options](https://en-gb.wordpress.org/plugins/tags/wp_options/)
 *  [Advanced View](https://en-gb.wordpress.org/plugins/delete-expired-transients/advanced/)

## Ratings

 5 out of 5 stars.

 *  [  13 5-star reviews     ](https://wordpress.org/support/plugin/delete-expired-transients/reviews/?filter=5)
 *  [  0 4-star reviews     ](https://wordpress.org/support/plugin/delete-expired-transients/reviews/?filter=4)
 *  [  0 3-star reviews     ](https://wordpress.org/support/plugin/delete-expired-transients/reviews/?filter=3)
 *  [  0 2-star reviews     ](https://wordpress.org/support/plugin/delete-expired-transients/reviews/?filter=2)
 *  [  0 1-star reviews     ](https://wordpress.org/support/plugin/delete-expired-transients/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/delete-expired-transients/reviews/#new-post)

[See all reviews](https://wordpress.org/support/plugin/delete-expired-transients/reviews/)

## Contributors

 *   [ webaware ](https://profiles.wordpress.org/webaware/)

## Support

Got something to say? Need help?

 [View support forum](https://wordpress.org/support/plugin/delete-expired-transients/)

## Donate

Would you like to support the advancement of this plugin?

 [ Donate to this plugin ](https://shop.webaware.com.au/donations/?donation_for=Delete+Expired+Transients)