Make WordPress Core

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#38941 closed defect (bug) (wontfix)

REST API - filter syntax isn't available

Reported by: andfinally Owned by:
Priority: normal Milestone:
Component: REST API Version: 4.7
Severity: normal Keywords:
Cc: Focuses: rest-api

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.

Change History (3)

#1 @swissspidy
10 years ago

Hey there,

The filter param has been removed on purpose. See #38378 for more information. The docs haven't been updated yet.

#2 @andfinally
10 years ago

  • Resolutionwontfix
  • Status newclosed

I see! Thanks - good to know. I'll close this.

#3 @johnbillion
10 years ago

  • Milestone Awaiting Review
Note: See TracTickets for help on using tickets.