Ticket #37218: 37218.3.diff
File 37218.3.diff, 1.0 KB (added by , 9 years ago) |
---|
-
src/wp-includes/functions.php
4279 4279 * 4280 4280 * @since 4.3.0 4281 4281 * 4282 * @global wpdb $wpdb WordPress database abstraction object.4283 4282 * 4284 4283 * @return int The ID of the main network. 4285 4284 */ 4286 4285 function get_main_network_id() { 4287 global $wpdb;4288 4286 4289 4287 if ( ! is_multisite() ) { 4290 4288 return 1; … … 4298 4296 // If the current network has an ID of 1, assume it is the main network. 4299 4297 $main_network_id = 1; 4300 4298 } else { 4301 $main_network_id = wp_cache_get( 'primary_network_id', 'site-options' ); 4302 4303 if ( false === $main_network_id ) { 4304 $main_network_id = (int) $wpdb->get_var( "SELECT id FROM {$wpdb->site} ORDER BY id LIMIT 1" ); 4305 wp_cache_add( 'primary_network_id', $main_network_id, 'site-options' ); 4299 $_networks = get_networks( array( 'fields' => 'ids', 'number' => 1 ) ); 4300 if ( ! empty( $_networks ) ) { 4301 $main_network_id = array_shift( $_networks ); 4306 4302 } 4307 4303 } 4308 4304