wpseek.com
Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.



is_main_site › WordPress Function

Od3.0.0
Przestarzałyn/a
is_main_site ( $site_id = null, $network_id = null )
Parametry: (2)
  • (int) $site_id Optional. Site ID to test. Defaults to current site.
    Wymagane: Nie
    Domyślny: null
  • (int) $network_id Optional. Network ID of the network to check for. Defaults to current network.
    Wymagane: Nie
    Domyślny: null
Powrót:
  • (bool) True if $site_id is the main site of the network, or if not running Multisite.
Zdefiniowane na:
Codex:
Dziennik zmian:
  • 4.9.0

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



Źródło

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;
}