Changeset 38632
- Timestamp:
- 09/20/2016 06:46:52 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/functions.php
r38608 r38632 4354 4354 * @since 4.3.0 4355 4355 * 4356 * @global wpdb $wpdb WordPress database abstraction object.4357 *4358 4356 * @return int The ID of the main network. 4359 4357 */ 4360 4358 function get_main_network_id() { 4361 global $wpdb;4362 4363 4359 if ( ! is_multisite() ) { 4364 4360 return 1; … … 4373 4369 $main_network_id = 1; 4374 4370 } else { 4375 $main_network_id = wp_cache_get( 'primary_network_id', 'site-options' ); 4376 4377 if ( false === $main_network_id ) { 4378 $main_network_id = (int) $wpdb->get_var( "SELECT id FROM {$wpdb->site} ORDER BY id LIMIT 1" ); 4379 wp_cache_add( 'primary_network_id', $main_network_id, 'site-options' ); 4380 } 4371 $_networks = get_networks( array( 'fields' => 'ids', 'number' => 1 ) ); 4372 $main_network_id = array_shift( $_networks ); 4381 4373 } 4382 4374
Note: See TracChangeset
for help on using the changeset viewer.