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

  1. The module scans your database for expired transients
  2. On the settings page, you see how many expired transients exist
  3. Click “Clean Transients Now” for immediate cleanup, or
  4. Enable automatic cleanup on a schedule (daily, twice daily, or weekly)
  5. 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

SettingOptionsDefaultDescription
Automatic CleanupEnabled / DisabledEnabledRun cleanup on a schedule
Cleanup ScheduleDaily, Twice Daily, WeeklyDailyHow 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 ActivityRecommended Schedule
Low traffic, few pluginsWeekly
Standard business siteDaily
High traffic, many pluginsTwice 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

ScenarioExpired TransientsTable Rows Saved
Small blog50-200100-400
Business site200-1,000400-2,000
Large e-commerce1,000-10,0002,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).

PRO

Get access to all 147 modules with a single license

Upgrade to Pro