WordPress Transients API offers a simple and standardized way of storing cached data in the database temporarily by giving it a custom name and a timeframe after which it will expire and be deleted.
The Transients API is very similar to the Options API but with the added feature of an expiration time, which simplifies the process of using the wp_options
database table to temporarily store cached information.
In addition if you have any of these questions then you are at correct location:
- What is WordPress Transients API?
- How to Delete Expired Transients Objects from WP_OPTIONS table?
- What are the _transient options for in the db?
- What is Memcache and working With Memcached in WordPress
- Do you have Trouble with Transient API?
- What is Do-It-Yourself Caching Methods With WordPress?
- How To Use Transients In Your WordPress Theme
WordPress uses DB entries called _transients
to cache certain data. Cached entries are by default, things like RSS info, when cron last run, etc. I believe there are few plugins which uses Transients API to get cached data. Unfortunately, either due to a bug in WordPress, or something left out of those plugins, this cached info doesn’t seem to be deleted after it’s designated expiration time/date (_transients
have a set expiration time. These entries may sometimes cause your blogs to crash. You get memory errors when trying to access the site.
I recently moved my blog from Crunchify.co to Crunchify.com and noticed so many below entries in wp_options table. (This is may be simply DB dumped to another one and none of the transient variable got cleaned up)
transient_feed_mod transient_timeout_dash transient_timeout_feed site_transient_timeout_browser etc....
It is 100% safe to optimize your table by removing all _transient_
entries. WordPress will generate new entries if requires in the future. Just use below query to optimize your wp_options table.
delete from `wp_options` where `option_name` like '_transient_%'
I’ve hosted my blog @Hostgator and used myPhpAdmin to clean up this table. Enjoy and Have a fun. List of all WordPress Tips.