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

3 Answers 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 );

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

Not to be used on a production server.


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
    Commented Jul 7, 2015 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
    Commented Jul 11, 2015 at 17:14

Install https://wp-cli.org/ and use the command

wp transient delete --all

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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