Make WordPress Core


Ignore:
Timestamp:
06/16/2020 06:02:55 AM (5 years ago)
Author:
whyisjake
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-query.php

    r47808 r48053  
    966966
    967967        if ( ! ( $this->is_singular || $this->is_archive || $this->is_search || $this->is_feed
    968                 || ( defined( 'REST_REQUEST' ) && REST_REQUEST )
     968                || ( defined( 'REST_REQUEST' ) && REST_REQUEST && $this->is_main_query() )
    969969                || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_robots || $this->is_favicon ) ) {
    970970            $this->is_home = true;
Note: See TracChangeset for help on using the changeset viewer.