[wp-trac] [WordPress Trac] #34373: Don't set is_home=>true in WP_Query during REST request

WordPress Trac noreply at wordpress.org
Wed Nov 18 19:23:33 UTC 2015


#34373: Don't set is_home=>true in WP_Query during REST request
--------------------------------------+------------------
 Reporter:  danielbachhuber           |       Owner:
     Type:  defect (bug)              |      Status:  new
 Priority:  normal                    |   Milestone:  4.4
Component:  REST API                  |     Version:
 Severity:  normal                    |  Resolution:
 Keywords:  dev-feedback needs-patch  |     Focuses:
--------------------------------------+------------------

Comment (by joehoyle):

 I think `is_home` should be `false`, as there's no such thing as a "home"
 request in the API. I don't really see the architectural argument for
 having `is_rest` in WP_Query, but given it's convenient for 3rd parties
 hooking into to WP_Query to modify things, having it there will no doubt
 be useful.

 It's worth mentioning that the REST API doesn't make use of the "main
 query", there is no `global $wp_query` on rest requests, where these nasty
 `is_` things are typically used.

 In terms of how we achieve this, I think the implementation of `is_rest`
 could just check for `defined( 'REST_REQUEST' )`?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/34373#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list