2

I am calling the api as http://examples.com/wp-json/wp/v2/posts?filter[category_name]=uncategorize&per_page=30&order=asc&search=hello

I am not able to get particular posts from that specific category. I got all results from all categories.Any suggestions please.

1 Answer 1

4

The filter parameter was removed as part of WP 4.7, to get the results you expect you'll need to change

http://examples.com/wp-json/wp/v2/posts?filter[category_name]=uncategorize&per_page=30&order=asc&search=hello

to

http://examples.com/wp-json/wp/v2/posts?categories=1&per_page=30&order=asc&search=hello

Make sure to change categories=0 to whatever uncategorised's tag_ID is.

If you'd like to restore the Filter parameter, I would recommend this plugin: https://github.com/WP-API/rest-filter

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.