Skip to content

Commit 6f63414

Browse files
authored
don't switch blog
Updated the query to delete transients from the correct blog's options table using the blog prefix.
1 parent 22c6352 commit 6f63414

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

includes/class-plugin.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,17 +1249,15 @@ protected function delete_multisite_transients() {
12491249

12501250
foreach ( $sites as $id ) {
12511251
try {
1252-
switch_to_blog( $id );
1252+
$prefix = $wpdb->get_blog_prefix( $id );
12531253

12541254
$wpdb->query( $wpdb->prepare(
1255-
"DELETE FROM {$wpdb->options} WHERE option_name LIKE %s", '_transient_%'
1255+
"DELETE FROM {$prefix}options WHERE option_name LIKE %s", '_transient_%'
12561256
) );
12571257
} catch ( Exception $error ) {
12581258
error_log($error->getMessage());
12591259
}
12601260
}
1261-
1262-
restore_current_blog();
12631261
}
12641262

12651263
/**

0 commit comments

Comments
 (0)