WordPress at a glance
function is not described

WP_Query::is_main_query() WP 3.3.0

Is the query the main query?

This is a method of the class: WP_Query

  • Global. WP_Query. $wp_query Global WP_Query instance.

No Hooks.

Return

true/false.

Usage

$WP_Query = new WP_Query();
$var = $WP_Query->is_main_query();

Code of WP Query::is main query: wp-includes/class-wp-query.php WP 5.2

<?php
public function is_main_query() {
	global $wp_the_query;
	return $wp_the_query === $this;
}