diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 6e2fce9718..360a2db83e 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -4353,13 +4353,9 @@ function is_main_network( $network_id = null ) { * * @since 4.3.0 * - * @global wpdb $wpdb WordPress database abstraction object. - * * @return int The ID of the main network. */ function get_main_network_id() { - global $wpdb; - if ( ! is_multisite() ) { return 1; } @@ -4372,12 +4368,8 @@ function get_main_network_id() { // If the current network has an ID of 1, assume it is the main network. $main_network_id = 1; } else { - $main_network_id = wp_cache_get( 'primary_network_id', 'site-options' ); - - if ( false === $main_network_id ) { - $main_network_id = (int) $wpdb->get_var( "SELECT id FROM {$wpdb->site} ORDER BY id LIMIT 1" ); - wp_cache_add( 'primary_network_id', $main_network_id, 'site-options' ); - } + $_networks = get_networks( array( 'fields' => 'ids', 'number' => 1 ) ); + $main_network_id = array_shift( $_networks ); } /** diff --git a/wp-includes/version.php b/wp-includes/version.php index 592e879b0b..a3963201d0 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.7-alpha-38631'; +$wp_version = '4.7-alpha-38632'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.