How to close wpdb connection? [duplicate]
Question
This question already has an answer here:
- Database connection close 3 answers
Is there any method to close connection similar to mysql_close()
for wpdb
in WordPress?
Is it not necessary to close connection for global wpdb
?
Solution
WP 4.5 had introduced wpdb->close()
method to close connection in current instance.
Old answer
There is no explicit method. It stores link identifier in $wpdb->dbh
field, but it is protected, so not convenient to run close on.
Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange