WordPress

How to Manage and Remove Transients in WordPress

Have you been running your WordPress site for a while now? Is your website running slower by the day? Well, there could be some cached data slowing down your site.

The cached information could have been stored in bulk hence making your website load slower when users try to view multiple pages. The cached data is also known as transients. During the years, it could have accumulated in bulk.

WordPress Developers stores data in the WordPress database using the Transients API. How does Transients API aid the performance of your WordPress Site? The general performance of your site can be enhanced using Transients API since they speed up its performance.

WordPress contains so many plugins, some of which may have extra data stored as cache. Transients clean all the data cached on your website.

What are Transients?

Have you tried emptying your site cache only to find the site not loading as fast as you expected? Deleting old and expired Transients from your site is vital since the expired ones can significantly slow down the site when stored for a while. WordPress automatically stores Transients records in the options table. 

The plugins use transients in your website to store data. You have to manually remove them since they can only be deleted when requested. If you fail to eliminate the Transients from the database, there could be millions of them taking up unnecessary space. 

Transients enhance WordPress Support by making sure other plugins are working correctly.

Differences between WordPress Transients and Cookies

Despite them both being used to store information temporarily, Transients are more powerful.

  • Cookies are less secure compared to Transients
  • You can program Transients, but you can’t do the same for Cookies

How to Manage Transients in WordPress

Install and activate the Transient Manager on your WordPress site. The transient manager helps in viewing, searching, editing, and deleting Transients from your WordPress site quickly without having to enter the database options table.

Go to the Tools section then Transients page. Here, you can view and manage all the Transients used on your website.

Transients in WordPress

While here, you will have a view of all the transients stored in the site database. There are options either to:

  • Delete all transients
  • Delete expired transients
  • Remove all transients with an expiry date

By merely looking at its name, you can quickly identify transients you want to manage. The value of the Transients appears next to the name column. Value of the Transient could be a number, object, or an alphanumeric string.

The expiration time will also appear, but for those Transients that will not expire soon will display as ‘Does not expire.’ You can either edit the value of the transients or delete it.

Edit Transients WordPress

Delete Expired Transients

The plugin does not store any personal identifying information. Data Expired Transients do not set any cookies. What it does is remove old data from your database, reducing the risks you could get when personal information was to fall into the wrong hands.

Delete Expired Transients

When Transients expire, they are stored in the database. The Delete Expired Transients plugin can be used to clean up the WP-option table. How do you go about it? 

First, install and activate the plugin. Go to the Tools section, then to Delete Transients. Here, you will find both the total number and the expired transients. You can delete them in bulk.

Delete Expired Transients wordpress

The Delete Expired Transients can also schedule tasks to delete the expired transients on the daily. By using an SQL query, the expired transients are removed. It runs a second query to find any transients that may have been missed and deletes them as well.

Transient Cleaner Plugin

WordPress Developers came up with a plugin that makes the transient cleaning process automatic. With the Transient Cleaner Plugin, you only have to activate it and watch as your site becomes cleaner, and faster.

Plugin Specifications

  • The Transient Cleaner is licensed under GPLv2 (General Public License). You have the freedom to study and modify its functionality options.
  • The plugin is International; and ready for translation
  • Able to have multi-sites installations
  • PHP7 Compatible
  • Gutenberg ready

Installation

The cleaner is found and installed through the Plugin menu located in your WordPress administration. Also, the Transient Cleaner can be manually installed by downloading it from WordPress.org.

  1. Go to your WP-content/plugins/directory and upload the artists-transient-cleaner folder
  2. Head to the Plugins menu and activate the Transient Cleaner plugin.

The Settings Screen

Head to Administration > Tools > Transients. A screen will appear, allowing you to set what cleaning options you want. You can set it to perform an ad-hoc run. All this happens at exactly the time you have scheduled it automatically.

Running In Lite Mode

While on the lite mode, the options screen is not available. However, especially in multi-site, there will be nobody tinkering with the settings.

Add the below code on the wp-config.php file to activate it.

define( ‘TC_LITE’, true );

Using Hooks

There are a couple of hooks to ease up your work on the site. Nobody loves or enjoys coding for WordPress. Well, not unless the reward is reasonable. These housekeeping functions are available:

  • housekeep transients – which will clear any expired transients
  • clear_all_transients – Which makes all expired transients
Using Hooks wordpress

Using the above steps, you can easily manage or delete transients from your site without having to enter the admin database. As a WordPress Developer, removing transients is vital in making your website more users friendly.

Leave a Reply