get_networks( string|array $args = array() ): array|int
Retrieves a list of networks.
Parameters
-
$args
string|array Optional -
Array or string of arguments. See WP_Network_Query::parse_query() for information on accepted arguments.
More Arguments from WP_Network_Query::parse_query( ... $query )
Array or query string of network query parameters.
network__in
int[]Array of network IDs to include.network__not_in
int[]Array of network IDs to exclude.count
boolWhether to return a network count (true) or array of network objects.
Default false.fields
stringNetwork fields to return. Accepts'ids'
(returns an array of network IDs) or empty (returns an array of complete network objects).number
intMaximum number of networks to retrieve. Default empty (no limit).offset
intNumber of networks to offset the query. Used to build LIMIT clause.
Default 0.no_found_rows
boolWhether to disable theSQL_CALC_FOUND_ROWS
query. Default true.orderby
string|arrayNetwork status or array of statuses. Accepts'id'
,'domain'
,'path'
,'domain_length'
,'path_length'
and'network__in'
. Also accepts false, an empty array, or'none'
to disableORDER BY
clause. Default'id'
.order
stringHow to order retrieved networks. Accepts'ASC'
,'DESC'
. Default'ASC'
.domain
stringLimit results to those affiliated with a given domain.domain__in
string[]Array of domains to include affiliated networks for.domain__not_in
string[]Array of domains to exclude affiliated networks for.path
stringLimit results to those affiliated with a given path.path__in
string[]Array of paths to include affiliated networks for.path__not_in
string[]Array of paths to exclude affiliated networks for.search
stringSearch term(s) to retrieve matching networks for.update_network_cache
boolWhether to prime the cache for found networks. Default true.
Default:
array()
Return
array|int List of WP_Network objects, a list of network IDs when 'fields'
is set to 'ids'
, or the number of networks when 'count'
is passed as a query var.
Source
File: wp-includes/ms-network.php
.
View all references
function get_networks( $args = array() ) {
$query = new WP_Network_Query();
return $query->query( $args );
}
Changelog
Version | Description |
---|---|
4.6.0 | Introduced. |