Function: is_main_network

is_main_network( integer $network_id )

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

Parameters

Name Type(s) Default Value Description
$network_id integer null

Optional. Network ID to test. Defaults to current network.

Returns

boolean

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

WordPress Developer Newsletter

Stay on top of the latest WordPress API changes, developer tool updates, security alerts and more.