3

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?

7

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!

3

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.