#38941 closed defect (bug) (wontfix)
REST API - filter syntax isn't available
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.7 |
Component: | REST API | Keywords: | |
Focuses: | rest-api | Cc: |
Description
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.
Hey there,
The
filter
param has been removed on purpose. See #38378 for more information. The docs haven't been updated yet.