Skip Navigation

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

Problem:
The client needed to remove the link from duplicated posts in WPML to make them translate independently, similar to the action of clicking the "Translate independently" button.
Solution:
We advised the client that to remove the duplicate status and make a post translate independently, they should delete the

_icl_lang_duplicate_of

field in the

wp_postmeta

table. This field links a duplicate post to its original. By removing this link, the post becomes an independent translation.

Additionally, we clarified that the function https://wpml.org/documentation/translating-your-contents/displaying-untranslated-content-on-pages-in-secondary-languages/#using-the-default-language-as-a-fallback-for-untranslated-content does not remove the duplicate link but rather controls the display settings for untranslated content.

If this solution does not resolve your issue or seems outdated, we recommend opening a new support ticket. We also highly suggest 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. For further assistance, please visit our support forum at WPML Support Forum.

100% of people find this useful.

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

Last updated by Bruno Kos 2 years, 4 months ago.

Assisted by: Bruno Kos.

Author Posts
January 26, 2023 at 2:01 am #12894281

glennv-11

Hi,

Since your plugin can't handle importing new translations via WP All import (When not imported parent language), I try to find a way myself.

What I did is duplicating all the posts (products) when there translation_type was set to 0.

My question is how I can remove the link from the duplicate now? It is the same action as clicking the "Translate independently" button (see screenshot). From there, all the translations have an own ID. With this ID I am able to update the translation bulkwise using WP All import.

btw. Why do you not implement a function like this in WP All Import? Now it's not very user friendly as it needs the parent import document.....

If you have a better way of doing this. Please let me know.

My code:

https://wpml.org/wpml-hook/wpml_element_translation_type/
https://wpml.org/wpml-hook/wpml_admin_make_post_duplicates/

function duplicateProductsTranslate() {
$products_IDs = new WP_Query( array(
'post_type' => 'product',
'posts_per_page' => -1,
));

while ($products_IDs->have_posts() ) : $products_IDs->the_post();
$productID = get_the_ID();
$translationStatus = apply_filters( 'wpml_element_translation_type', NULL, $productID, 'post' );
if($translationStatus == 0){
do_action( 'wpml_admin_make_post_duplicates', $productID );
}
endwhile;
}

hidden link

WPMLCapture.PNG
January 26, 2023 at 9:25 am #12895693

Bruno Kos
WPML Supporter since 12/2018

Languages: English (English ) German (Deutsch ) French (Français )

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

Hi,

Thank you for contacting WPML support!

There has to be a parent import because otherwise it would be impossible for WPML to understand which page is original and what is the translation. Because you need to connect them somehow, as you can easily have a scenario where you have for example 10000 translations, any way other than automatic ( so through original and parent import where you use the unique key to connect them) would be impossible to achieve.

But as for your question of removing duplicate status, does it help if I tell you that there is a _icl_lang_duplicate_of field within wp_postmeta?

Have a look at my screenshots - if you have duplicate with ID 56, it would have _icl_lang_duplicate_of value where the ID of that value is its original, in my case 27.

If you delete _icl_lang_duplicate_of, it would become independent translation.

Regards,
Bruno Kos

icl-lang.jpg
translate.jpg
January 26, 2023 at 12:09 pm #12897251

glennv-11

Hi Bruno,

Thank you for your prompt reply. I will try that method, thanks.

I just have found this https://wpml.org/wpml-hook/wpml_set_translation_mode_for_post_type/ as it sets the mode to translated , doesn't it remove de duplicate link aswell?

Regards Glenn

January 26, 2023 at 12:40 pm #12897407

Bruno Kos
WPML Supporter since 12/2018

Languages: English (English ) German (Deutsch ) French (Français )

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

Hi,

No, this function does something else. This only controls this for any given post type:
https://wpml.org/documentation/translating-your-contents/displaying-untranslated-content-on-pages-in-secondary-languages/#using-the-default-language-as-a-fallback-for-untranslated-content

So this is only a matter of setting and not physical duplication or translation of these contents.

Regards,
Bruno Kos