Expired transients are temporary cached values that WordPress or plugins can recreate. Cleaning expired transients can reduce accumulated database clutter, but it is different from deleting orders, sessions, options or every cache entry on the server.
IN THIS ARTICLE
01 Check whether cleanup is appropriate
Take a database backup and identify the active installation first. Record the problem you are trying to solve, such as a large number of expired cache records. If the site is slow, measure it before cleanup so you can tell whether the change helped. A large options table alone does not identify which rows are safe to remove.
02 Use the supported expired-only operation
With authorised SSH access and WP-CLI available, confirm the installation directory and intended site URL. Replace both placeholders in this expired-only operation before running it:
wp transient delete --expired --path=/path/to/wordpress --url=https://example.com
Review the reported result and any errors. On Multisite, normal site transients and network transients have different scopes. Choose the correct site with the appropriate context and only add network scope when that is part of the reviewed task.
What changes when persistent object caching is enabled?
With an external object-cache drop-in, current transients may live in the cache backend instead of the WordPress database. Database cleanup therefore does not necessarily describe all active cached values. Check the site's actual cache arrangement before interpreting counts or attempting a wider flush.
Should I delete all transients instead?
Not as a routine substitute for expired-only cleanup. Removing unexpired values can cause many expensive operations to run again and may affect plugin workflows that use temporary state. Never delete rows merely because an option name looks unfamiliar, and do not clear a shared Redis or Memcached service globally to tidy one website.
03 Verify the result and address recurrence
- Check the site's key pages and the feature connected to the original problem.
- Compare database size or row counts and the performance measurements taken before cleanup.
- Review scheduled-task health if expired records keep accumulating.
- Identify a plugin producing unusually large temporary values and use its supported maintenance procedure or contact its developer.
Keep cleanup logs free of customer data and credentials. If the site becomes unstable, pause further deletion and use the backup and change record to plan recovery. A successful transient cleanup is a maintenance action, not proof that the entire database is healthy or free of security problems.