[wp-trac] [WordPress Trac] #38941: REST API - filter syntax isn't available

WordPress Trac noreply at wordpress.org
Fri Nov 25 17:21:56 UTC 2016


#38941: REST API - filter syntax isn't available
--------------------------+-----------------------------
 Reporter:  andfinally    |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  REST API      |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:  rest-api      |
--------------------------+-----------------------------
 I'm on WordPress 4.7 beta 4, and I'm finding the filter syntax isn't
 working.

 The filter argument is listed in the v2 docs http://v2.wp-
 api.org/reference/posts/. But when I do a GET request to /wp-json/ filter
 is not listed in the args for the /wp/v2/posts GET endpoint.

 I have three posts in my local environment. When I do a GET request to
 /wp-json/wp/v2/posts/?categories=2 I get the one post that belongs to the
 category with the ID 2. This category has the name News and slug news.

 When I do requests like
 /wp-json/wp/v2/posts?filter[cat]=2
 /wp-json/wp/v2/posts?filter[category_name]=News
 /wp-json/wp/v2/posts?filter[posts_per_page]=1
 I get all three of my posts. From what I read on StackOverflow, this
 suggests the API isn't recognising the filter.

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


More information about the wp-trac mailing list