Uses
Uses | Description |
---|---|
wp-includes/wp-db.php: wpdb::get_results() | Retrieves an entire SQL result set from the database (i.e., many rows). |
Fetch the total size of all the database tables for the active database user.
(int) The size of the database, in bytes.
File: wp-admin/includes/class-wp-debug-data.php
public static function get_database_size() { global $wpdb; $size = 0; $rows = $wpdb->get_results( 'SHOW TABLE STATUS', ARRAY_A ); if ( $wpdb->num_rows > 0 ) { foreach ( $rows as $row ) { $size += $row['Data_length'] + $row['Index_length']; } } return (int) $size; }
Version | Description |
---|---|
5.2.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_debug_data/get_database_size