WP_Network_Query
- Since
- 4.6.0
- Source
wp-includes/class-wp-network-query.php:17
Core class used for querying networks.
Hooks fired · 6
Every hook that fires from inside WP_Network_Query, in the order it appears in the class, grouped by the method that fires it.
WP_Network_Query::get_networks()
- do_action( pre_get_networks )action line 208
- apply_filters( networks_pre_query )filter line 242
- apply_filters( the_networks )filter line 318
Properties · 7
$requeststringpublic- SQL for database query.
$sql_clausesarray{protected- SQL query clauses.
$query_varsarray<string,public- Query vars set by the user.
$query_var_defaultsarray<string,public- Default values for query vars.
$networksWP_Network[]|int[]public- List of networks located by the query.
$found_networksintpublic- The amount of found networks for the current query.
$max_num_pagesintpublic- The number of pages.
Methods · 9
- __construct()Constructor.
- parse_query()Parses arguments passed to the network query with default query parameters.
- query()Sets up the WordPress query for retrieving networks.
- get_networks()Gets a list of networks matching the query vars.
- get_network_ids()Used internally to get a list of network IDs matching the query vars.
- set_found_networks()Populates found_networks and max_num_pages properties for the current query if the limit clause was used.
- get_search_sql()Used internally to generate an SQL string for searching across multiple columns.
- parse_orderby()Parses and sanitizes 'orderby' keys passed to the network query.
- parse_order()Parses an 'order' query variable and cast it to 'ASC' or 'DESC' as necessary.
Source
#[AllowDynamicProperties]class WP_Network_Query { /** * SQL for database query. * * @since 4.6.0 * @var string */ public $request; /** * SQL query clauses. * * @since 4.6.0 * @var array{ * select: string, * from: string, * where: array<string, string>, * groupby: string, * orderby: string, * limits: string * } */ protected $sql_clauses = array( 'select' => '', 'from' => '', 'where' => array(), 'groupby' => '', 'orderby' => '', 'limits' => '', ); /** * Query vars set by the user. * * @since 4.6.0 * @var array<string, mixed> */ public $query_vars; /** * Default values for query vars. * * @since 4.6.0 * @var array<string, mixed> */ public $query_var_defaults; /** * List of networks located by the query. * * @since 4.6.0 * @var WP_Network[]|int[] */ public $networks; /** * The amount of found networks for the current query. * * @since 4.6.0 * @var int * @phpstan-var non-negative-int */ public $found_networks = 0; /** * The number of pages. * * @since 4.6.0 * @var int * @phpstan-var non-negative-int */ public $max_num_pages = 0; /** * Constructor. * * Sets up the network query, based on the query vars passed. *History
Introduced in 4.6.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, from
src/wp-includes/class-wp-network-query.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.