Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client wants to automatically translate articles using PHP when they are published in English, and then mark them for review. They also need to notify registered translators for the specific language translation, in this case, English to Dutch.
Solution:
Currently, WPML does not support this specific requirement directly. To achieve this functionality, it requires custom development. We recommend using WPML's hooks and filters to implement such a solution. You can find more information and guidance on our WPML Hooks Reference.
If you require further assistance with the development, consider hiring one of our certified WPML contractors who specialize in custom multilingual solutions.

Please note that this solution might be outdated or not applicable to your specific case. We highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If this does not resolve your issue, please open a new support ticket.

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 3 replies, has 0 voices.

Last updated by Carlos Rojas 3 weeks, 4 days ago.

Assisted by: Carlos Rojas.

Author Posts
May 22, 2025 at 7:41 am #17059743

marcS-37

Background of the issue:
I want to automatically translate an article using PHP. The site is hidden link but the registration hasn't updated. When an article is published in English, I want to send it for automatic translation. I have a hook set up but need some code I can call to send it for automatic translation and mark it for review. Once it is marked for review, I want to send the new article email I am currently sending to all registered translators for that language, for example, from English to Dutch.

Symptoms:
No specific issue or error message mentioned.

Questions:
How can I send a post by ID to automatic translation and set it to publish then mark for review?
How can I get a list of users who are registered for English to Dutch translation?

May 22, 2025 at 8:31 am #17060055

Carlos Rojas
WPML Supporter since 03/2017

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

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

Hello,
Thank you for reaching out to us.

At the moment, WPML does not offer built-in support for this specific configuration. Implementing such a solution would require custom development, which unfortunately falls outside the scope of our support services.

However, you may be able to achieve your goal using WPML's available hooks and filters. I recommend reviewing our WPML Hooks Reference here: WPML Hooks Reference

If you need assistance with the development, you can contact one of our certified WPML contractors who specialize in custom multilingual solutions.

Thank you very much for your understanding!
Best regards,
Carlos

May 22, 2025 at 11:27 am #17061269

marcS-37

I've managed to figure it out and write some code to do it. For anyone else who needs it here is how you can get a list of translators per language:

function codev_get_wpml_translators() {
global $sitepress;

if (!$sitepress || !method_exists($sitepress, 'get_active_languages') || !function_exists('wpml_tm_load_blog_translators')) {
return [];
}

$translators = [];
$active_languages = $sitepress->get_active_languages();;
$all_translators = wpml_tm_load_blog_translators()->get_blog_translators();

foreach ($active_languages as $lang_code => $language) {
// Skip English as that's the source language
if ($lang_code === 'en') {
continue;
}

$lang_translators = [];

foreach ($all_translators as $translator) {
if (isset($translator->language_pairs['en'])) {
if (in_array($lang_code, $translator->language_pairs['en'])) {
$lang_translators[] = $translator;
}
}
}

if (!empty($lang_translators)) {
$translators[$lang_code] = [
'language' => $language,
'users' => $lang_translators
];
}
}

return $translators;
}

May 22, 2025 at 12:46 pm #17061814

Carlos Rojas
WPML Supporter since 03/2017

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

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

Thank you very much for sharing the code.

Please don't hesitate to contact us if you need our help with WPML.

Have an excellent day!