wpseek.com
Outil de recherche WordPress pour les développeurs et auteurs de thèmes



get_main_site_id › WordPress Function

Depuis4.9.0
Dépréciéen/a
get_main_site_id ( $network_id = null )
Paramètres:
  • (int) $network_id Optional. The ID of the network for which to get the main site. Defaults to the current network.
    Requis: Non
    Défaut: null
Retourne:
  • (int) The ID of the main site.
Défini(e) dans:
Codex:

Gets the main site ID.



Source

function get_main_site_id( $network_id = null ) {
	if ( ! is_multisite() ) {
		return get_current_blog_id();
	}

	$network = get_network( $network_id );
	if ( ! $network ) {
		return 0;
	}

	return $network->site_id;
}