On this page
WP_Network_Query::__construct( string|array $query = '' )
Constructor.
Description
Sets up the network query, based on the query vars passed.
Parameters
$querystring|array Optional-
Array or query string of network query parameters.
network__inint[]Array of network IDs to include.network__not_inint[]Array of network IDs to exclude.countboolWhether to return a network count (true) or array of network objects.
Default false.fieldsstringNetwork fields to return. Accepts'ids'(returns an array of network IDs) or empty (returns an array of complete network objects).numberintMaximum number of networks to retrieve. Default empty (no limit).offsetintNumber of networks to offset the query. Used to build LIMIT clause.
Default 0.no_found_rowsboolWhether to disable theSQL_CALC_FOUND_ROWSquery. Default true.orderbystring|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 BYclause. Default'id'.orderstringHow to order retrieved networks. Accepts'ASC','DESC'. Default'ASC'.domainstringLimit results to those affiliated with a given domain.domain__instring[]Array of domains to include affiliated networks for.domain__not_instring[]Array of domains to exclude affiliated networks for.pathstringLimit results to those affiliated with a given path.path__instring[]Array of paths to include affiliated networks for.path__not_instring[]Array of paths to exclude affiliated networks for.searchstringSearch term(s) to retrieve matching networks for.update_network_cacheboolWhether to prime the cache for found networks. Default true.
Default:
''
Source
File: wp-includes/class-wp-network-query.php. View all references
public function __construct( $query = '' ) {
$this->query_var_defaults = array(
'network__in' => '',
'network__not_in' => '',
'count' => false,
'fields' => '',
'number' => '',
'offset' => '',
'no_found_rows' => true,
'orderby' => 'id',
'order' => 'ASC',
'domain' => '',
'domain__in' => '',
'domain__not_in' => '',
'path' => '',
'path__in' => '',
'path__not_in' => '',
'search' => '',
'update_network_cache' => true,
);
if ( ! empty( $query ) ) {
$this->query( $query );
}
}
Related
Uses
| Uses | Description |
|---|---|
| WP_Network_Query::query() wp-includes/class-wp-network-query.php | Sets up the WordPress query for retrieving networks. |
Used By
| Used By | Description |
|---|---|
| WP_Debug_Data::debug_data() wp-admin/includes/class-wp-debug-data.php | Static function for generating site debug data when required. |
| get_networks() wp-includes/ms-network.php | Retrieves a list of networks. |
Changelog
| Version | Description |
|---|---|
| 4.6.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_network_query/__construct