[wp-trac] [WordPress Trac] #38629: REST API: Allowed public or private WP_Query vars are lost in `prepare_items_query()`

WordPress Trac noreply at wordpress.org
Wed Nov 2 20:51:28 UTC 2016


#38629: REST API: Allowed public or private WP_Query vars are lost in
`prepare_items_query()`
--------------------------+-------------------------
 Reporter:  rachelbaker   |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  4.7
Component:  REST API      |    Version:  trunk
 Severity:  normal        |   Keywords:  needs-patch
  Focuses:                |
--------------------------+-------------------------
 Expected behavior #1: using a public WP query var like `?cat=5` should
 filter the collection response from `wp/v2/posts`

 Expected behavior #2: Using the `rest_query_vars` filter, I should be able
 to include a private query var, like `tag_slug__in` and requests to
 `wp/v2/posts?tag_slug__in=myslug` should filter the collection response.

 The issue appears to be in `prepare_items_query()` where we are only
 checking if `$prepared_args` are set and included in the `$valid_vars`
 array.   We are not including additional vars from the `$request` object.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/38629>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list