2

Is there an easy way to delete all transient caches? A plugin maybe? Or like in drupal "drush cc all"?

3

Not tested, but if you need a quick and dirty way, you could put a script like this in your WordPress folder and call it each time:

define( 'WP_USE_THEMES', false );
require('wp-blog-header.php');

global $wpdb;
$wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE '%\_transient\_%'" );

Not to be used on a production server.

1

If you can access your database through phpmyadmin or something equivalent, I would recommand you to use this :

DELETE a, b FROM wp_options a, wp_options b  WHERE a.option_name LIKE '_transient_%' 
AND a.option_name 
NOT LIKE '_transient_timeout_%' 
AND b.option_name = CONCAT( '_transient_timeout_', SUBSTRING( a.option_name, CHAR_LENGTH('_transient_') + 1 ) ) AND b.option_value < UNIX_TIMESTAMP()
  • What is the meaning of your SQL delete command @JMau? – Nam G VU Jul 7 '15 at 10:47
  • @NamGVU it's a little bit complicated but basically we do not want to mess up with transients used by WP core itself and those which are actually running. We want only expired transients. – JMau Jul 11 '15 at 17:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.