is_main_network( int $network_id = null ): bool

In this article

Determines whether a network is the main network of the Multisite installation.

Parameters

$network_idintoptional
Network ID to test. Defaults to current network.

Default:null

Return

bool True if $network_id is the main network, or if not running Multisite.

Source

function is_main_network( $network_id = null ) {	if ( ! is_multisite() ) {	return true;	}	if ( null === $network_id ) {	$network_id = get_current_network_id();	}	$network_id = (int) $network_id;	return ( get_main_network_id() === $network_id ); } 

Changelog

VersionDescription
3.7.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.