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

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

Leave a Reply

Your email address will not be published. Required fields are marked *