wppaste
WordPress

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.

Properties · 7

$requeststringpublic
SQL for database query.
$sql_clausesarrayprotected
SQL query clauses.
$query_varsarraypublic
Query vars set by the user.
$query_var_defaultsarraypublic
Default values for query vars.
$networksarraypublic
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	 */	protected $sql_clauses = array(		'select'  => '',		'from'    => '',		'where'   => array(),		'groupby' => '',		'orderby' => '',		'limits'  => '',	); 	/**	 * Query vars set by the user.	 *	 * @since 4.6.0	 * @var array	 */	public $query_vars; 	/**	 * Default values for query vars.	 *	 * @since 4.6.0	 * @var array	 */	public $query_var_defaults; 	/**	 * List of networks located by the query.	 *	 * @since 4.6.0	 * @var array	 */	public $networks; 	/**	 * The amount of found networks for the current query.	 *	 * @since 4.6.0	 * @var int	 */	public $found_networks = 0; 	/**	 * The number of pages.	 *	 * @since 4.6.0	 * @var int	 */	public $max_num_pages = 0; 	/**	 * Constructor.	 *	 * Sets up the network query, based on the query vars passed.	 *	 * @since 4.6.0	 *	 * @param string|array $query {	 *     Optional. Array or query string of network query parameters. Default empty.	 *	 *     @type int[]        $network__in          Array of network IDs to include. Default empty.	 *     @type int[]        $network__not_in      Array of network IDs to exclude. Default empty.	 *     @type bool         $count                Whether to return a network count (true) or array of network objects.	 *                                              Default false.

History

Introduced in 4.6.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 6.8.8 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.