WordPress transients provide a simple and standardized way for developers to store cached data in the database temporarily, along with a timeframe for which it will expire and be deleted.
While transients normally expire on their own, this isn’t always the case. If things go wrong (which happens more than you might think), you can easily get hundreds of thousands of transient records in your site’s wp_options
table. And this can bring your site to a crawl; we’ve seen it many times.
The good news is, in almost all cases, it’s safe to delete transients as they will rebuild themselves after the fact. Check out below how our MySQL load dropped immediately after we cleared out transients on a site where the wp_options
table had spiraled out of control.
Expired transients
Follow the steps below on how to delete expired transients on your WordPress site.
Important: These functions make permanent changes that cannot be reverted! Back up your database before proceeding.
Step 1
Click into the Perfmatters plugin settings.
Step 2
Click on the “Tools” submenu.
Step 3
Click on the “Database” submenu.
Step 4
Toggle on “Expired Transients.” The number of expired transients found will show up to the right of it.
Step 5
Scroll down and click “Optimize Now.”
The process will run in the background. You don’t need to stay in the plugin while it’s running or worry about leaving the window open.
It will let you know when it’s finished with a notification at the top of the Perfmatters plugin settings.
All transients
Follow the steps below on how to delete all transients on your WordPress site.
Important: These functions make permanent changes that cannot be reverted! Back up your database before proceeding.
Step 1
Click into the Perfmatters plugin settings.
Step 2
Click on the “Tools” submenu.
Step 3
Click on the “Database” submenu.
Step 4
Scroll down and toggle on “All Transients.” The number of all transients found will show up to the right of it.
Step 5
Scroll down and click “Optimize Now.”
The process will run in the background. You don’t need to stay in the plugin while it’s running or worry about leaving the window open.
It will let you know when it’s finished with a notification at the top of the Perfmatters plugin settings.
Troubleshooting
You might be wondering after you delete transients why some remain. This is completely normal as the needed transients are automatically rebuilt by plugins and themes. The purpose of deleting transients is to remove old ones that are no longer needed.
Check out our documentation on WordPress database optimization for other easy ways to clean up your database with Perfmatters. You can also delete your WordPress transients on an automated schedule.