wpdb::check_database_version
Determines whether the database server is at least the required minimum version.
Method of the class: wpdb{}
No Hooks.
Returns
null|WP_Error.
Usage
global $wpdb; $wpdb->check_database_version();
Notes
- Global. String.
$required_mysql_versionThe minimum required MySQL version string.
Changelog
| Since 2.5.0 | Introduced. |
wpdb::check_database_version() wpdb::check database version code WP 7.0
public function check_database_version() {
global $required_mysql_version;
$wp_version = wp_get_wp_version();
// Make sure the server has the required MySQL version.
if ( version_compare( $this->db_version(), $required_mysql_version, '<' ) ) {
/* translators: 1: WordPress version number, 2: Minimum required MySQL version number. */
return new WP_Error( 'database_version', sprintf( __( '<strong>Error:</strong> WordPress %1$s requires MySQL %2$s or higher' ), $wp_version, $required_mysql_version ) );
}
}