WP_Debug_Data::get_mysql_var
Returns the value of a MySQL system variable.
Method of the class: WP_Debug_Data{}
No Hooks.
Returns
String|null. The variable value on success. Null if the variable does not exist.
Usage
$result = WP_Debug_Data::get_mysql_var( $mysql_var );
- $mysql_var(string) (required)
- Name of the MySQL system variable.
Notes
- Global. wpdb.
$wpdbWordPress database abstraction object.
Changelog
| Since 5.9.0 | Introduced. |
WP_Debug_Data::get_mysql_var() WP Debug Data::get mysql var code WP 6.9.1
public static function get_mysql_var( $mysql_var ) {
global $wpdb;
$result = $wpdb->get_row(
$wpdb->prepare( 'SHOW VARIABLES LIKE %s', $mysql_var ),
ARRAY_A
);
if ( ! empty( $result ) && array_key_exists( 'Value', $result ) ) {
return $result['Value'];
}
return null;
}