From 78747f9353f669167375cb3382a75acd066d6ae7 Mon Sep 17 00:00:00 2001 From: Jake Spurlock Date: Tue, 16 Jun 2020 06:02:55 +0000 Subject: [PATCH] REST API: Allow queries other than the main query to be `is_home`. Ensure that REST API calls can match the main query of the page. See #34373. Fixes #50213. Props: dlh, TimothyBlynJacobs, boonebgorges, joemcgill, whyisjake. git-svn-id: https://develop.svn.wordpress.org/trunk@48053 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/class-wp-query.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/class-wp-query.php b/src/wp-includes/class-wp-query.php index 5027f21cf0..9f1a1b3fb5 100644 --- a/src/wp-includes/class-wp-query.php +++ b/src/wp-includes/class-wp-query.php @@ -965,7 +965,7 @@ class WP_Query { } if ( ! ( $this->is_singular || $this->is_archive || $this->is_search || $this->is_feed - || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) + || ( defined( 'REST_REQUEST' ) && REST_REQUEST && $this->is_main_query() ) || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_robots || $this->is_favicon ) ) { $this->is_home = true; }