Transients are a way of temporarily storing data in WordPress, conceptually similar to a sticky note. Transients are always created with a set maximum lifetime, after which they expire and are deleted.
Many theme and plugin developers don’t understand the proper use of transients: many transients in the average WordPress database either a) don’t have expiration dates, or b) don’t follow best practice and store their
Unless you implement a form of ‘garbage collection’, these transients will simply accumulate in your database and over time, will slow your site down bit by bit.
If you install an object cache like
Redis on your server, these key/value entities will no longer be stored as “transients” in your MySQL database, but will instead exist in the object cache, where they may disappear because the cache was flushed, web service restarted or server rebooted.
WordPress includes a cron event called
delete_expired_transients which calls the
delete_expired_transients() function automatically when the cron event runs.
You should implement for resilience:
- Delete all transients from your WordPress database (see below)
- Install and activate object caching (
Memcached) on your server
- Disable wp-cron and configure server cron.
Via WordPress CLI
Delete expired transients.
wp transient delete --expired Success: 12 expired transients deleted from the database.
Delete all transients
wp transient delete --all Success: 14 transients deleted from the database.
In phpMyAdmin, select your website database and run the following SQL Query:
DELETE FROM `wp_options` WHERE `option_name` LIKE ('%\_transient\_%')
That’s it, you’re done!