On this page
Understanding WordPress transients: what they are and how to manage them
WordPress transients are temporary cached values stored in your database, and expired ones can quietly build up and slow your site down.
WordPress transients are a lightweight caching mechanism built into WordPress. They let plugins and themes store temporary data in your database with an expiry time, avoiding repeated slow operations such as API calls or complex queries.
What transients are
When a plugin fetches data from an external API or runs an expensive database query, it often saves the result as a transient. The next time that data is needed, WordPress reads it straight from the database rather than repeating the work. Once the expiry time passes, WordPress discards the cached value and fetches fresh data on the next request.
Transients are stored in the wp_options table alongside your site's persistent settings - they do not live in a separate table. Each transient has three related rows: the value itself, a timeout record, and a flag that marks it as a transient. Persistent options, by contrast, have no expiry and are intended to last indefinitely.
The mechanism is genuinely useful. Without it, every page load might trigger dozens of slow external requests or heavy queries. The problem arises not with transients themselves, but with what happens when they are no longer needed.
Why expired transients build up
WordPress uses lazy deletion: it only removes a transient when something tries to read it after its expiry time. If nothing ever reads that transient again - because a plugin was deactivated, a feature was removed, or a page simply stopped being visited - the expired record stays in wp_options indefinitely.
Several things accelerate this build-up:
- Active plugins and page builders can generate hundreds or thousands of transients over time, particularly those that cache search results, widget output, or remote feed data.
- Removing a plugin without cleaning up its data leaves orphaned transients behind. The plugin is gone but its cached rows remain.
- High-traffic sites accumulate expired transients faster because more operations are cached in the first place.
Over months or years, a busy site can end up with tens of thousands of stale rows in wp_options, making every database query that scans that table slower than it needs to be.
How to identify the problem
The signs are often subtle at first:
- The WordPress admin dashboard feels sluggish, particularly on pages that query
wp_optionsheavily. - A query monitor plugin flags slow or repeated queries against
wp_options. - Your database size seems large relative to the amount of content on your site.
- cPanel's disk usage shows a database that has grown steadily without an obvious reason.
To check how many expired transients you have, you can use either of these approaches.
Plugin-based check: Install a database optimisation plugin such as WP-Optimize. Most tools in this category will show you a count of expired transients before you delete anything, so you can see the scale of the problem.
phpMyAdmin: Open phpMyAdmin from cPanel, select your WordPress database, and use the Search or SQL tab to query the wp_options table. You are looking for rows where option_name starts with _transient_timeout_ and the stored value (the expiry timestamp) is less than the current Unix time. The article on running SQL queries on a database with phpMyAdmin explains how to use the SQL tab if you have not done this before.
If you are not comfortable writing SQL queries, use a plugin instead. The plugin approach is safer for non-technical users and produces the same result.
How to clean up expired transients safely
Before you do anything, take a database backup. This is a required step, not an optional precaution - if something goes wrong during cleanup you need a restore point. You can create a full account backup in cPanel or restore a database backup if you need to roll back. WP Toolkit also lets you take a site-specific backup that covers just your WordPress database.
Once you have a backup, choose one of the following methods.
Option 1: LiteSpeed Cache database optimisation (recommended)
If you already have LiteSpeed Cache installed - which most Kualo customers do - it includes a database optimisation tool that can clear expired transients without any extra plugins. This is the approach we recommend.
- Log in to your WordPress admin dashboard.
- Go to LiteSpeed Cache in the left-hand menu, then open Toolbox.
- Click the DB Optimiser tab.
- You will see a list of database items that can be cleaned, including expired transients. Review the counts before proceeding.
- Click Optimise next to expired transients (or run a full optimisation if you are comfortable with the other items listed).
Cleaning transients through LiteSpeed Cache's DB Optimiser is a separate action from purging the LiteSpeed page cache. Purging the page cache clears cached HTML pages served by LiteSpeed; cleaning transients removes stale data from your WordPress database. The two operations are independent - doing one does not do the other.
For full guidance on LiteSpeed Cache, see configuring LiteSpeed Cache with WordPress.
Option 2: A dedicated database cleanup plugin
If you do not have LiteSpeed Cache installed, a dedicated plugin such as WP-Optimize is a well-regarded alternative. It provides a clear interface for reviewing and deleting expired transients, along with other database maintenance tasks such as removing post revisions and spam comments.
- Install and activate the plugin from the WordPress plugin directory.
- Navigate to the plugin's database cleanup section.
- Select expired transients from the list of items to clean.
- Run the optimisation.
See how to manage your plugins in WordPress if you need a reminder of how to install plugins.
Option 3: Manual deletion via phpMyAdmin (advanced users only)
This method is for users who are confident working directly with databases. If you are not sure, use one of the plugin-based options above.
Always take a database backup before running any DELETE query manually. A mistake in phpMyAdmin cannot be undone without a backup. See how to back up your website in cPanel before continuing.
- Open phpMyAdmin from cPanel and select your WordPress database.
- Click the SQL tab.
- Run the following query to delete expired transients only:
DELETE FROM wp_options
WHERE option_name LIKE '_transient_timeout_%'
AND option_value < UNIX_TIMESTAMP();
DELETE FROM wp_options
WHERE option_name LIKE '_transient_%'
AND option_name NOT LIKE '_transient_timeout_%'
AND REPLACE(option_name, '_transient_', '_transient_timeout_')
NOT IN (
SELECT option_name FROM (
SELECT option_name FROM wp_options
WHERE option_name LIKE '_transient_timeout_%'
) AS t
);
If your WordPress database uses a custom table prefix other than wp_, replace wp_options with your actual table name throughout the query. You can check your prefix in wp-config.php.
For a walkthrough of the phpMyAdmin interface, see becoming familiar with databases in phpMyAdmin.
What not to do
Do not bulk-delete all transients indiscriminately. Some plugins store non-expired transients that are actively in use - for example, authentication tokens, licence verification data, or live API responses. Deleting those will break functionality and may log users out or disable plugin features until the data is regenerated. Always target expired transients only, as the methods above do.
Preventing future build-up
Cleaning up once is useful, but scheduling regular maintenance is better.
- Automate cleanup with LiteSpeed Cache or WP-Optimize. Both tools support scheduled database optimisation. Setting a weekly or fortnightly run means expired transients are cleared automatically without you having to remember.
- Keep plugins up to date. Newer versions of plugins often include improved transient handling, including better cleanup on deactivation. Outdated plugins are one of the most common sources of orphaned transients. See how to update your WordPress installation and managing and auditing WordPress plugins for performance for practical guidance.
- Remove plugins you no longer use. Deactivating a plugin does not always clean up its data. Delete plugins you no longer need rather than leaving them deactivated.
- Review your database periodically. The guidance in understanding and reducing database query load in WordPress covers broader database health and is worth reading alongside this article.
With regular maintenance in place, transient build-up should stay manageable and your database will stay lean and fast.