get_current_network_id
Retrieves the current network ID.
Description
(int) get_current_network_id();
Returns (int)
The ID of the current network.
Usage
if ( !function_exists( 'get_current_network_id' ) ) { require_once ABSPATH . WPINC . '/load.php'; } // NOTICE! Understand what this does before running. $result = get_current_network_id();
Defined (1)
The function is defined in the following location(s).
- /wp-includes/load.php
- function get_current_network_id() {
- if ( ! is_multisite() ) {
- return 1;
- }
- $current_network = get_network();
- if ( ! isset( $current_network->id ) ) {
- return get_main_network_id();
- }
- return absint( $current_network->id );
- }