How to Delete Transients in WordPress

Delete Transients in WordPress

WordPress plugins and themes can store a lot of temporary data known as transients. By default, these transients are stored in the wp_options table and can accumulate rather quickly. Due to an idiosyncrasy in WordPress core, expired transients are only removed from the database if access to them is attempted, if no access to them is made then the transients stay in the wp_options table. This tutorial will show you how to delete expired transients using WP-CLI from wp_options or your external object cache and automate the deletion of these transients every day using a cronjob.

What are transients in WordPress

Delete the value of a network site transient. On a single site, this is a specially-named cache key. On multisite, this is a global cache (instead of local to the site).

WordPress theme and plugin developers make use of these transients to store timely data to increase speed and efficiency. For instance, a plugin or theme may want to check for updates every 24 hours. Once checked, this data is stored as a transient so that the plugin or theme doesn’t make another request every time the page loads.

See Also  How to Migrate WordPress Website to new Hosting

The good thing is that this transient data will automatically expire at set periods. However, sometimes these transients may quickly pile up and you may not see some changes you made right away. Moreover, the piled-up transients may also increase the database size.

WordPress Transients API offers a simple and standardized way of storing cached data in the database. It is also possible to use APC or Memcached to store the transients, thus increasing the overall performance of a WordPress site. When we do so, the existing transients are not removed from the database. The following commands help to do just that.

Code to Delete Transients

DELETE FROM `wp_options` WHERE `option_name` LIKE ('_transient_%');
DELETE FROM `wp_options` WHERE `option_name` LIKE ('_site_transient_%');

To increase performance, WordPress plugins may use the transients API to store some data in the database. While this does increase performance, some old data can be left by disabled or removed plugins that can adversely affect performance. In this article, we will show you how to remove expired transients from your WordPress database.

0 0 votes
Article Rating

Related articles

Hajj Registration App

The Ministry of Hajj and Umrah announced that booking...

2 ways to reset WordPress password when email access lost

What if, your email associated with your WordPress profile...

How to install WordPress in hosting

How to install WordPress in hosting Installing WordPress can be...

Install WordPress manually in Fast 6 ways

Install WordPress manually WordPress can be installed manually in hosting,...

How to install Plugins in WordPress

How to Install a WordPress Plugin for Beginners In this...

Case Studies

Compass Music Platform

A clothing brand wanted to launch a new e-commerce website that would allow customers to browse and purchase their products online. We developed a...

NewsWeek Magazine

A clothing brand wanted to launch a new e-commerce website that would allow customers to browse and purchase their products online. We developed a...

Beauty & Makeup Shop

A clothing brand wanted to launch a new e-commerce website that would allow customers to browse and purchase their products online. We developed a...
0
Would love your thoughts, please comment.x
()
x