View Code? Open in Web Editor
NEW
This plugin allows you to flush WordPress transients, plain and simple.
Home Page: https://wordpress.org/plugins/flush-transients/
License: GNU General Public License v2.0
flush-transients's People
Contributors
Watchers
flush-transients's Issues
If object caches is enabled, transiants are not stored in database the site meta / options tables. Query like this will not work.
|
$result = $wpdb->query( |
|
$wpdb->prepare( |
|
// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared |
|
"DELETE FROM {$table_name} WHERE {$table_column} LIKE %s AND {$table_column} NOT LIKE %s", |
|
$wpdb->esc_like( $transient_prefix ) . '%', |
|
$wpdb->esc_like( $timeout_prefix ) . '%' |
|
) |
|
); |
|
$transient_count = (int) $wpdb->get_var( |
|
$wpdb->prepare( |
|
// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared |
|
"SELECT COUNT({$table_column}) FROM {$table_name} WHERE {$table_column} LIKE %s AND {$table_column} NOT LIKE %s", |
|
$wpdb->esc_like( $transient_prefix ) . '%', |
|
$wpdb->esc_like( $timeout_prefix ) . '%' |
|
) |
|
); |