get_network()
最后更新于:2021-11-26 09:54:57
get_network( GC_Network|int|null$network=null)Retrieves network data given a network ID or network object.
参数
- $network
-
(GC_Network|int|null) (Optional) Network to retrieve. Default is the current network.
Default value: null
响应
(GC_Network|null) The network object or null if not found.
源文件
文件: gc-includes/ms-network.php
function get_network( $network = null ) {
global $current_site;
if ( empty( $network ) && isset( $current_site ) ) {
$network = $current_site;
}
if ( $network instanceof GC_Network ) {
$_network = $network;
} elseif ( is_object( $network ) ) {
$_network = new GC_Network( $network );
} else {
$_network = GC_Network::get_instance( $network );
}
if ( ! $_network ) {
return null;
}
/**
* Fires after a network is retrieved.
*
* @since 4.6.0
*
* @param GC_Network $_network Network data.
*/
$_network = apply_filters( 'get_network', $_network );
return $_network;
}