rest api – WP API ignores filter parameter

Question

I’m trying to return a list of posts or media via the Rest API

But it seems that when a filter incorrectly specified then a whole page of results is passed back.

So a curl command like

curl -gv  "myamazingsite.co.uk/wp-json/wp/v2/media/?filterhttps://wordpress.stackexchange.com/q/247387=123"

returns all media items, instead of a empty list.

now

curl -gv  "myamazingsite.co.uk/wp-json/wp/v2/media/?filter[year]=2016"

I get all media for that year.

and

curl -gv  "myamazingsite.co.uk/wp-json/wp/v2/media/?filter[year]=2015"

returns an empty list [] , because there isn’t any..fine.

So, I assume that id is not a valid filter argument, but why do I not get an error message?

The documentation for filter arg just links to wp_query method, which seems to be all about the PHP function, I admit I know very little about PHP, so I find this very confusing as to what it is saying…

0
Mesh 4 years 2016-11-25T07:24:27-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse