Function: is_main_site

is_main_site( integer $site_id, integer $network_id )

Determine whether a site is the main site of the current network.


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

Optional. Site ID to test. Defaults to current site.

$network_id integer null

Optional. Network ID of the network to check for. Defaults to current network.



True if $site_id is the main site of the 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.