is_main_site() – Determine whether a site is the main site of the current network.

You appear to be a bot. Output may be restricted

Description

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

Usage

$bool = is_main_site( $site_id, $network_id );

Parameters

$site_id
( int ) optional – Optional. Site ID to test. Defaults to current site.
$network_id
( int ) optional – Optional. Network ID of the network to check for. Defaults to current network.

Returns

bool True if $site_id is the main site of the network, or if not running Multisite.

Source

File name: wordpress/wp-includes/functions.php
Lines:

1 to 13 of 13
function is_main_site( $site_id = null, $network_id = null ) {
  if ( ! is_multisite() ) {
    return true;
  }

  if ( ! $site_id ) {
    $site_id = get_current_blog_id();
  }

  $site_id = (int) $site_id;

  return get_main_site_id( $network_id ) === $site_id;
}
 

 View on GitHub View on Trac