On this page
WP_Site_Query::parse_query( string|array $query = '' )
Parses arguments passed to the site query with default query parameters.
Description
See also
Parameters
$querystring|array Optional-
Array or string of WP_Site_Query arguments. See WP_Site_Query::__construct().
More Arguments from WP_Site_Query::__construct( ... $query )
Array or query string of site query parameters.
site__inint[]Array of site IDs to include.site__not_inint[]Array of site IDs to exclude.countboolWhether to return a site count (true) or array of site objects.
Default false.date_queryarrayDate query clauses to limit sites by. See WP_Date_Query.
Default null.fieldsstringSite fields to return. Accepts'ids'(returns an array of site IDs) or empty (returns an array of complete site objects).IDintA site ID to only return that site.numberintMaximum number of sites to retrieve. Default 100.offsetintNumber of sites to offset the query. Used to build LIMIT clause.
Default 0.no_found_rowsboolWhether to disable theSQL_CALC_FOUND_ROWSquery. Default true.orderbystring|arraySite status or array of statuses. Accepts:
'id''domain''path''network_id''last_updated''registered''domain_length''path_length''site__in''network__in''deleted''mature''spam''archived''public'- false, an empty array, or
'none'to disableORDER BYclause.
'id'.orderstringHow to order retrieved sites. Accepts'ASC','DESC'. Default'ASC'.network_idintLimit results to those affiliated with a given network ID. If 0, include all networks. Default 0.network__inint[]Array of network IDs to include affiliated sites for.network__not_inint[]Array of network IDs to exclude affiliated sites for.domainstringLimit results to those affiliated with a given domain.domain__instring[]Array of domains to include affiliated sites for.domain__not_instring[]Array of domains to exclude affiliated sites for.pathstringLimit results to those affiliated with a given path.path__instring[]Array of paths to include affiliated sites for.path__not_instring[]Array of paths to exclude affiliated sites for.publicintLimit results to public sites. Accepts'1'or'0'.archivedintLimit results to archived sites. Accepts'1'or'0'.matureintLimit results to mature sites. Accepts'1'or'0'.spamintLimit results to spam sites. Accepts'1'or'0'.deletedintLimit results to deleted sites. Accepts'1'or'0'.lang_idintLimit results to a language ID.lang__instring[]Array of language IDs to include affiliated sites for.lang__not_instring[]Array of language IDs to exclude affiliated sites for.searchstringSearch term(s) to retrieve matching sites for.search_columnsstring[]Array of column names to be searched. Accepts'domain'and'path'.
Default empty array.update_site_cacheboolWhether to prime the cache for found sites. Default true.update_site_meta_cacheboolWhether to prime the metadata cache for found sites. Default true.meta_keystring|string[]Meta key or keys to filter by.meta_valuestring|string[]Meta value or values to filter by.meta_comparestringMySQL operator used for comparing the meta value.
See WP_Meta_Query::__construct() for accepted values and default value.meta_compare_keystringMySQL operator used for comparing the meta key.
See WP_Meta_Query::__construct() for accepted values and default value.meta_typestringMySQL data type that the meta_value column will be CAST to for comparisons.
See WP_Meta_Query::__construct() for accepted values and default value.meta_type_keystringMySQL data type that the meta_key column will be CAST to for comparisons.
See WP_Meta_Query::__construct() for accepted values and default value.meta_queryarrayAn associative array of WP_Meta_Query arguments.
See WP_Meta_Query::__construct() for accepted values.
Default:
''
Source
File: wp-includes/class-wp-site-query.php. View all references
public function parse_query( $query = '' ) {
if ( empty( $query ) ) {
$query = $this->query_vars;
}
$this->query_vars = wp_parse_args( $query, $this->query_var_defaults );
/**
* Fires after the site query vars have been parsed.
*
* @since 4.6.0
*
* @param WP_Site_Query $query The WP_Site_Query instance (passed by reference).
*/
do_action_ref_array( 'parse_site_query', array( &$this ) );
}
Hooks
- do_action_ref_array( 'parse_site_query',
WP_Site_Query $query ) -
Fires after the site query vars have been parsed.
Related
Uses
| Uses | Description |
|---|---|
| do_action_ref_array() wp-includes/plugin.php | Calls the callback functions that have been added to an action hook, specifying arguments in an array. |
| wp_parse_args() wp-includes/functions.php | Merges user defined arguments into defaults array. |
Used By
| Used By | Description |
|---|---|
| WP_Site_Query::get_sites() wp-includes/class-wp-site-query.php | Retrieves a list of sites matching the query vars. |
Changelog
| Version | Description |
|---|---|
| 4.6.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_site_query/parse_query