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
This commit is contained in:
Jake Spurlock 2020-06-16 06:02:55 +00:00
parent 5f49b025aa
commit 78747f9353

View File

@ -965,7 +965,7 @@ class WP_Query {
} }
if ( ! ( $this->is_singular || $this->is_archive || $this->is_search || $this->is_feed 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_trackback || $this->is_404 || $this->is_admin || $this->is_robots || $this->is_favicon ) ) {
$this->is_home = true; $this->is_home = true;
} }