maximeschoeni / sublanguage

Multilanguage plugin for wordpress
42 stars 13 forks source link

Post slug and link are not being translated when using the REST API #32

Open dsoares7 opened 6 years ago

dsoares7 commented 6 years ago

Hello!

I'm trying to use Wordpress REST API, and I ran into a problem: the post slug and link are not being translated when listing posts using /wp-json/. I can set the language by passing "language=en" to the URL, but only the post title and content are translated correctly.

This is an example of the API call I'm using:

[blog url]/wp-json/wp/v2/posts?language=en

JSON returned:

image

In the above example, the slug I expected to be: how-to-create-a-dashboard and the link: [blog url]/en/how-to-create-a-dashboard/. Both are keeping their respective default language values.

Is this a bug, or am I using the API/Sublanguage the wrong way?

Any help is appreciated.

Wordpress version: 4.9.4 Sublanguage version: 2.4