Custom REST endpoints for a custom post type with custom fields

Question

I am working on a wordpress project that is highly customized. I have custom post type “foo-post” and within there I have a custom field “foo-field” (created by advanced custom fields plugin and is just a simple string).

Now I want to be able to query this “foo-Post” through the REST API. I have managed to include this custom post in API response, but the problem is that I want to filter the output based on “foo-field”. Is it possible to create a route that can be called like this:

       /wp-json/v2/wp/foo-post?foo-field=something

If so, please help me figure out how to do that.

Thanks in advance

0
, , Reza Ghochkhani 7 years 2017-02-22T01:35:24-05:00 0 Answers 63 views 0

Leave an answer

Browse
Browse