diff --git a/src/wp-includes/wp-db.php b/src/wp-includes/wp-db.php index 6f60e9c31a..f31e5caa67 100644 --- a/src/wp-includes/wp-db.php +++ b/src/wp-includes/wp-db.php @@ -2461,7 +2461,8 @@ class wpdb { } // Change the charset to match the string(s) we're converting - if ( $charset !== $this->charset ) { + if ( $charset !== $connection_charset ) { + $connection_charset = $charset; $this->set_charset( $this->dbh, $charset ); } @@ -2482,7 +2483,7 @@ class wpdb { // Don't forget to change the charset back! if ( $connection_charset !== $this->charset ) { - $this->set_charset( $this->dbh, $connection_charset ); + $this->set_charset( $this->dbh ); } }