Determines whether the query is the main query.
Return
bool Whether the query is the main query.Source
public function is_main_query() {
global $wp_the_query;
return $wp_the_query === $this;
}
View all references View on Trac View on GitHub
Related
| Used by | Description |
|---|---|
wp_get_loading_optimization_attributes()wp-includes/media.php | Gets loading optimization attributes. |
_resolve_template_for_new_post()wp-includes/block-template.php | Sets the current WP_Query to return auto-draft posts. |
wp_get_loading_attr_default()wp-includes/deprecated.php | Gets the default value to use for a |
WP_Query::parse_query()wp-includes/class-wp-query.php | Parses a query string and sets query type booleans. |
WP_Query::parse_search()wp-includes/class-wp-query.php | Generates SQL for the WHERE clause based on passed search terms. |
is_main_query()wp-includes/query.php | Determines whether the query is the main query. |
Changelog
| Version | Description |
|---|---|
| 3.3.0 | Introduced. |