[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 18:36:00 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 danielbachhuber):

 Just so it's clearly stated, as a developer:

 * I'd expect `is_home=>false` and `is_rest=>true` when I hook into
 `pre_get_posts` to filter a query.
 * I'd expect `is_rest=>true` when I use WP_Query inside of a custom
 endpoint callback, such that any callbacks hooked onto `pre_get_posts`
 know the appropriate context.

 For the greatest precision, `WP_Query` should set `is_rest=>true` any time
 it's called within `WP_REST_SERVER::dispatch()`.

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


More information about the wp-trac mailing list