From b3dfd9e95317e35ad308a91e588137758e1e3ebb Mon Sep 17 00:00:00 2001 From: nacin Date: Sat, 17 Sep 2011 20:46:35 +0000 Subject: [PATCH] is_main_query(). fixes #18677. git-svn-id: http://svn.automattic.com/wordpress/trunk@18699 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/query.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/wp-includes/query.php b/wp-includes/query.php index 6e8582bcf..f47a860a2 100644 --- a/wp-includes/query.php +++ b/wp-includes/query.php @@ -715,6 +715,18 @@ function is_404() { return $wp_query->is_404(); } +/** + * Is the query the main query? + * + * @since 3.3.0 + * + * @return bool + */ +function is_main_query() { + global $wp_query; + return $wp_query->is_main_query(); +} + /* * The Loop. Post loop control. */ @@ -3467,6 +3479,18 @@ class WP_Query { function is_404() { return (bool) $this->is_404; } + + /** + * Is the query the main query? + * + * @since 3.3.0 + * + * @return bool + */ + function is_main_query() { + global $wp_the_query; + return $wp_the_query === $this; + } } /**