Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 1 reply, has 2 voices.

Last updated by Marcel 4 years, 3 months ago.

Assisted by: Marcel.

Author Posts
February 9, 2021 at 3:08 pm #8043169

michaelG-69

Hi, I have a headless wordpress CMS feeding content to a web application using the wordpress REST API.

How can I get the translated version of a page through the REST API if the slug is different?

So far I'm doing the following:

hidden link (EN version)
hidden link (FR version)

How would I be able to get the translated version if the slug is different?

February 10, 2021 at 9:53 am #8049563

Marcel
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: Europe/Madrid (GMT+02:00)

Hi,

Thank you for contacting WPML Support.

Per default, you can get translated versions adding a language parameter in your REST request. Anyway, GraphQL, which is very popular for headless CMS can't handle such URL parameters. Are you using GraphQL in your web app?

If yes, please check this article, where there is a 3rd party plugin recommended to use: hidden link. Please note this plugin is not developed nor supported by us.

If you are not using GraphQL you can try this workaround too: https://wpml.org/forums/topic/how-can-i-get-all-pages-original-and-translated-in-the-api-response/#post-3072937. Please note that you may have an issue with media files as mentioned here: https://wpml.org/forums/topic/retrieve-all-media-in-rest-api/#post-4092471

If you need a more complex integration, I recommend you to send us a vote for this functionality via a feature request: https://wpml.org/suggest-a-new-feature-for-wpml/

Best Regards
Marcel