wpseek.com
Uma área de pesquisa sobre o WordPress para devs e autores do tema
get_main_network_id › WordPress Function
Desde4.3.0
Obsoleton/a
› get_main_network_id ( Sem parâmetros )
| Retorna: |
|
| Definido em: |
|
| Codex: |
Gets the main network ID.
Funções relacionadas: get_current_network_id, is_main_network, get_main_site_id, get_network, get_networks
Fonte
function get_main_network_id() {
if ( ! is_multisite() ) {
return 1;
}
$current_network = get_network();
if ( defined( 'PRIMARY_NETWORK_ID' ) ) {
$main_network_id = PRIMARY_NETWORK_ID;
} elseif ( isset( $current_network->id ) && 1 === (int) $current_network->id ) {
// If the current network has an ID of 1, assume it is the main network.
$main_network_id = 1;
} else {
$_networks = get_networks(
array(
'fields' => 'ids',
'number' => 1,
)
);
$main_network_id = array_shift( $_networks );
}
/**
* Filters the main network ID.
*
* @since 4.3.0
*
* @param int $main_network_id The ID of the main network.
*/
return (int) apply_filters( 'get_main_network_id', $main_network_id );
}