I am trying to get posts from blog: http://christianconcepts.com/ which are tagged “appcontent”. I tried this querry:

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

but it I still get unfiltered results. For example, this post: http://christianconcepts.com/pdf-ebook-available/ doesn’t have “appcontent” tag but it is still returned.

“REST API – Filter Fields” plugin is installed.
Could someone help me?

1 Answer
1

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 Reply

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