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.

Tagged: 

This topic contains 1 reply, has 0 voices.

Last updated by jeony 1 day, 22 hours ago.

Assisted by: Dražen.

Author Posts
March 15, 2025 at 12:53 pm #16819824

jeony

Background of the issue:
I am using Make.com to automate translations via the WordPress REST API and GPT API to generate custom translations instead of using WPML's built-in translation services. While I have successfully posted the translated content via the API, the translated articles are not linking to their original English posts in WPML. I checked the original post’s trid using WPML API and found the translations object is empty. I posted the translated content via API and checked WPML again, but the response still shows no connection. I tried manually updating the translation connection using the WPML API, but there was no change. I am using GPT API for custom localization based on each country’s audience, which WPML’s built-in translation system does not allow. Make.com is being used for automation, and without proper WPML linking, I cannot efficiently manage multilingual content. The expected outcome is for the translated post (22014) to be linked under translations in the response from the WPML API.

Symptoms:
The translated post (22014) is not appearing under translations in WPML, and the translations object is empty.

Questions:
Why is WPML not linking the translated post to the original post?
Is there an additional API call needed to establish the translation connection?
Are there known limitations when using REST API to create WPML translations?
What is the correct way to link translations programmatically using WPML’s API?

March 17, 2025 at 8:02 am #16823240

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

thanks for contacting us.

Creating post and page translation using Rest API is not tightly integrated with WPML yet. You can use the language parameter to create a translation (?lang=fr) however, it will still need some custom work to connect the translation with the original content of the post/page.

There is a custom workaround a WPML user shared before sometime ago. other users reported that is working great, but keep in mind that this is not coming from WPML so we cannot support it:

Finally i created a custom endpoint to link the 2 translations.

This is my code : hidden link

So the process is :
1- create the first post in language 1 (classic API POST call)
2- create the second post in language 2 (classic API POST call)
3- link both (custom endpoint)

Hope is gonna help people

You can use our hooks to add a few more functionalities:
- https://wpml.org/wpml-hook/wpml_set_element_language_details/ (connecting translations)
- https://wpml.org/documentation/support/wpml-coding-api/wpml-hooks-reference/

NOTE: While this is a great workaround always have a backup in place when using custom code either provided by us or another member of this forum.

Regards,
Drazen

March 22, 2025 at 6:07 am #16846873

jeony

thx