Ticket #37218: 37218.4.diff
File 37218.4.diff, 1.0 KB (added by , 8 years ago) |
---|
-
src/wp-includes/functions.php
4350 4350 * 4351 4351 * @since 4.3.0 4352 4352 * 4353 * @global wpdb $wpdb WordPress database abstraction object.4354 *4355 4353 * @return int The ID of the main network. 4356 4354 */ 4357 4355 function get_main_network_id() { 4358 global $wpdb;4359 4356 4360 4357 if ( ! is_multisite() ) { 4361 4358 return 1; … … 4369 4366 // If the current network has an ID of 1, assume it is the main network. 4370 4367 $main_network_id = 1; 4371 4368 } else { 4372 $main_network_id = wp_cache_get( 'primary_network_id', 'site-options' ); 4373 4374 if ( false === $main_network_id ) { 4375 $main_network_id = (int) $wpdb->get_var( "SELECT id FROM {$wpdb->site} ORDER BY id LIMIT 1" ); 4376 wp_cache_add( 'primary_network_id', $main_network_id, 'site-options' ); 4377 } 4369 $_networks = get_networks( array( 'fields' => 'ids', 'number' => 1 ) ); 4370 $main_network_id = array_shift( $_networks ); 4378 4371 } 4379 4372 4380 4373 /**