Transients Cleaner
Automatically clean up expired transients from your WordPress database—keeping your options table lean and your queries fast.
Use Cases
- Remove expired transients that WordPress doesn’t always auto-delete
- Set up scheduled cleanup (daily, weekly) so your database stays optimized
- Manually trigger cleanup when you notice database bloat
- Reduce options table size for faster site performance
How It Works
- The module scans your database for expired transients
- On the settings page, you see how many expired transients exist
- Click “Clean Transients Now” for immediate cleanup, or
- Enable automatic cleanup on a schedule (daily, twice daily, or weekly)
- Expired transients are deleted using WordPress’s native
delete_transient()function
What Are Transients?
Transients are WordPress’s way of storing temporary cached data. Plugins and themes use them to cache:
- API responses (so they don’t hit external services on every page load)
- Complex query results (to avoid recalculating expensive operations)
- Session data and temporary tokens
- Feed content and remote data
Each transient has an expiration time. When it expires, WordPress should delete it—but this doesn’t always happen reliably, leading to “orphaned” expired transients accumulating over time.
Settings
| Setting | Options | Default | Description |
|---|---|---|---|
| Automatic Cleanup | Enabled / Disabled | Enabled | Run cleanup on a schedule |
| Cleanup Schedule | Daily, Twice Daily, Weekly | Daily | How often to auto-clean |
Where to Find It
Location: Switchboard → Modules → Optimization → Transients Cleaner
The settings page shows:
- Current count of expired transients
- A “Clean Transients Now” button for manual cleanup
- Schedule configuration for automatic cleanup
Manual vs. Automatic Cleanup
Manual Cleanup
Click “Clean Transients Now” anytime you want to clear expired transients immediately. Use this when:
- You’re troubleshooting a slow site
- You just deactivated plugins that used lots of transients
- You want to clean up before a database backup
Automatic Cleanup
Enable scheduled cleanup and let the module handle it. Recommended settings:
| Site Activity | Recommended Schedule |
|---|---|
| Low traffic, few plugins | Weekly |
| Standard business site | Daily |
| High traffic, many plugins | Twice Daily |
FAQ
Why doesn’t WordPress delete expired transients automatically?
WordPress deletes transients when they’re requested after expiration—not proactively. If a transient expires but nothing ever asks for it again, it stays in the database forever. This is called “lazy deletion” and it’s why expired transients accumulate.Is it safe to delete expired transients?
Yes. By definition, expired transients are no longer valid. Plugins and themes that need them will regenerate fresh ones automatically. Deleting expired transients never breaks functionality.How many transients is normal?
It varies wildly. A simple site might have 50-100 transients. A site with caching plugins, social sharing, SEO tools, and page builders might have thousands. What matters is how many are expired—those are the ones to clean.Will this delete my cache?
Transients are a form of cache, but this only deletes expired ones. Active, valid transients (with future expiration dates) are left alone. Your plugins’ caches continue working normally.What about transients without expiration?
Some transients are created without expiration times (permanent transients). This module only cleans transients that have expired—permanent ones are not touched.How do I know if transients are slowing my site?
Look at your wp_options table size. If it’s unusually large (over 5MB for a simple site), expired transients might be part of the problem. The module shows you the count of expired transients on its settings page.Enable daily automatic cleanup and forget about it. Your database stays optimized without any manual intervention.
Technical Details
Transients are stored in the wp_options table with names like:
_transient_example_name(the cached value)_transient_timeout_example_name(the expiration timestamp)
The module queries for timeout entries where the timestamp is less than the current time, then uses delete_transient() to properly remove both the value and timeout entries.
Impact on Database Size
| Scenario | Expired Transients | Table Rows Saved |
|---|---|---|
| Small blog | 50-200 | 100-400 |
| Business site | 200-1,000 | 400-2,000 |
| Large e-commerce | 1,000-10,000 | 2,000-20,000 |
Each transient uses 2 rows in wp_options (value + timeout). Cleaning 1,000 expired transients removes 2,000 database rows.
Cleanup Data
The module records when cleanup runs and how many transients were cleaned. This data is stored in the WordPress options table (switchboard_transients_cleaner_last_run).
Get access to all 147 modules with a single license