This is a quick and simple way to delete all transients in WordPress. Add this to your functions.php
file. Run it once by visiting the site in your browser. Then, to stop it from running, you can comment out the last line until you need to use it again.
(See this instead to delete only expired transients.)
(See the comment below for an easier WP-CLI solution.)
/** * Delete ALL transients from the wpdb */ function isa_delete_all_transients() { global $wpdb; $sql = 'DELETE FROM ' . $wpdb->options . ' WHERE option_name LIKE "_transient_%"'; $wpdb->query($sql); } add_action( 'init', 'isa_delete_all_transients' );
Simon Blackbourn
November 23rd, 2016 at 12:07 pm
Even easier with WP-CLI:
🙂