Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I remove transients in the wp_options table of my WordPress install?

I have recently noticed that my wp_options table seems to be a bit large. It contains 1161 rows, and is about 2.1mb in size.

I have installed Clean Options. It looks like development stopped on the plugin back in 2010, but it still did the job.

I now have a long list of potentially orphaned entries. Is there an easy way to go about sorting these, and figuring out which to remove and which to keep? Also, could this be responsible for causing performance issues with the website?

Thank you for reading, any ideas are welcomed!

Update: The Clean Options plugin returned some transients in the list, which lead me to find out that there are several hundred transient files in the wp_options table. There are a whole bunch that look like:

  • _site_transient_browser_5728a0f1503de54634b3716638...
  • _site_transient_timeout_browser_03df11ec4fda7630a5...
  • _transient_feed_83dcaee0f69f63186d51bf9a4...
  • _transient_plugin_slugs
  • _transient_timeout_feed_83dcaee0f69f63186d51bf9a4b...

and so on. Like I said, there are several hundred rows that take look like this. Is it safe to just dump them?

Thanks

like image 286
Ryan Avatar asked May 02 '12 22:05

Ryan


People also ask

Can I delete all WordPress transients?

Select all expired transients and all transients are selected to be deleted in the settings and then click on the Save changes and optimize button. Then click on the clear transient options button which will then clear all of the existing transients.

Is it safe to delete all transients?

It can cause performance issues over-time and cause the options database table to group. So ideally you would want to delete expired transients on any of the MainWP Child Sites you manage to improve performance.

How do I get rid of transients?

Simply navigate to Settings » WP Rocket and then click on the 'Database' menu option. Then, scroll down to the 'Transients Cleanup' section. Here you can check the boxes, if you want to automatically remove all or only expired transients.

Where are WordPress transients stored?

Transient values are stored in the wp_options table just like regular options. With transients, an additional option is stored to hold the expiration date. When a transient is accessed, WordPress pulls the expiration date first.


1 Answers

You can safetly dump them. Wordpress and some plugins will re-create transients as needed. A transient is more or less the stored value from a complex query. The results are saved as a transient so that the system doesn't have to perform a common query over and over, instead it just looks for the transient if it exists and hasn't expired. Of course, make a backup of your database before making a change lest something goes wrong!

After backing everything up, you can run a mysql statement like this:

DELETE FROM `wp_options` WHERE `option_name` LIKE ('%\_transient\_%') 

[EDIT: statement fixed with escape characters, after comment suggestion]

like image 185
Lane Avatar answered Oct 21 '22 17:10

Lane