Reputation: 43
My goal
I want to be able to send a request like this https://myblog.com/wp-json/wp/v2/categories?language=4
to get only the categories that are assigned to my language with the ID 4.
What I have tried
I have already added the code mentioned by @mastababa
here.
So now I am able to call https://myblog.com/wp-json/wp/v2/language
to get all languages defined by me via the plugin Polylang and after that I can call https://myblog.com/wp-json/wp/v2/posts?language=4
to get all posts only for the language with the ID 4.
I am using Wordpress 5.5.1 and Polylang 2.8.3
Thanks for your help!
Upvotes: 0
Views: 2912
Reputation: 385
I think by default you need Polylang Pro to be able to do that. See docs: https://polylang.pro/doc/rest-api/ Then you can call API like this: https://myblog.com/wp-json/wp/v2/categories?lang=en
Upvotes: 0