filter
is not supported by the core REST API; it can be added in by using the https://github.com/wp-api/rest-filter plugin, but we encourage querying by ID over slug (as slugs can change unexpectedly in some situations). The approach I use to query by term slug is roughly this:
– Query the media category terms collection endpoint with ?slug=mediacategoryslug
and make a note of the matched item’s ID
– Query the media endpoint with ?media_category[]=XX
, where XX is the ID of the matched post from the first request
While this is two requests, not one, you can store the ID of the term locally in your app so that you don’t need to re-request it later to make subsequent calls.
-
This reply was modified 7 years, 7 months ago by
K. Adam White. Reason: removed potentially confusing brackets