WP Rest API v2 return posts with specific tag

The filter param was removed in WP4.7, you should be able to access tags via their ID. For example to get the tag with the ID of 7 you could use:

http://YOUSIITE.DEV/wp-json/wp/v2/posts?tags=7

If you would like to add filters back in the WP-API team released their own Filter plugin, I’d recommend that you check that out: https://github.com/WP-API/rest-filter. From what I could see “REST API – Filter Fields” plugin actually restricts the content that is received from the API, it doesn’t add Filter back in.

If you are adding the filter back in, remove the forward slash after posts, for example update:

http://christianconcepts.com/wp-json/wp/v2/posts/?filter[tag]=appcontent

to

http://christianconcepts.com/wp-json/wp/v2/posts?filter[tag]=appcontent

Hope that helps!

Leave a Comment