W3cubDocs

/WordPress

get_current_network_id()

Retrieves the current network ID.

Description

Return

(int) The ID of the current network.

Source

File: 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 );
}

Changelog

Version Description
4.6.0 Introduced.

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/get_current_network_id