Ticket #33900: 33900.diff
File 33900.diff, 1.7 KB (added by , 8 years ago) |
---|
-
src/wp-includes/functions.php
4242 4242 * 4243 4243 * @since 4.3.0 4244 4244 * 4245 * @global wpdb $wpdb WordPress database abstraction object. 4245 * @global wpdb $wpdb WordPress database abstraction object. 4246 * @global WP_Network $current_site The current network. 4246 4247 * 4247 4248 * @return int The ID of the main network. 4248 4249 */ 4249 4250 function get_main_network_id() { 4250 global $wpdb ;4251 global $wpdb, $current_site; 4251 4252 4252 4253 if ( ! is_multisite() ) { 4253 4254 return 1; … … 4255 4256 4256 4257 if ( defined( 'PRIMARY_NETWORK_ID' ) ) { 4257 4258 $main_network_id = PRIMARY_NETWORK_ID; 4258 } elseif ( 1 === (int) get_current_site()->id ) {4259 } elseif ( isset( $current_site->id ) && 1 === (int) $current_site->id ) { 4259 4260 // If the current network has an ID of 1, assume it is the main network. 4260 4261 $main_network_id = 1; 4261 4262 } else { -
src/wp-includes/load.php
808 808 } 809 809 810 810 /** 811 * Retrieves the current network ID. 812 * 813 * @since 4.6.0 814 * 815 * @global WP_Network $current_site The current network. 816 * 817 * @return int The ID of the current network. 818 */ 819 function get_current_network_id() { 820 global $current_site; 821 822 if ( ! is_multisite() ) { 823 return 1; 824 } 825 826 if ( ! isset( $current_site->id ) ) { 827 return get_main_network_id(); 828 } 829 830 return absint( $current_site->id ); 831 } 832 833 /** 811 834 * Attempt an early load of translations. 812 835 * 813 836 * Used for errors encountered during the initial loading process, before