wpdb::close
Closes the current database connection.
Method of the class: wpdb{}
No Hooks.
Returns
true|false. True if the connection was successfully closed, false if it wasn't, or if the connection doesn't exist.
Usage
global $wpdb; $wpdb->close();
Changelog
| Since 4.5.0 | Introduced. |
wpdb::close() wpdb::close code WP 6.9.1
public function close() {
if ( ! $this->dbh ) {
return false;
}
$closed = mysqli_close( $this->dbh );
if ( $closed ) {
$this->dbh = null;
$this->ready = false;
$this->has_connected = false;
}
return $closed;
}