[ Web Proxy ]
URL:
Viewing: https://developer.wordpress.org/reference/classes/wp_query/is_main_query/ [Back]  [Original]

WP_Query::is_main_query() Method | Developer.WordPress.org Skip to content
WordPress.org

WP_Query::is_main_query(): bool

In this article

Table of Contents

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;
}
Used byDescription
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 loading attribute on an element.

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.

Show 1 moreShow less

Changelog

VersionDescription
3.3.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.


Web Proxy Viewer  |  New URL  |  Original Page