Skip to content Skip to sidebar

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

Problem:
If you're experiencing issues with the 'Rewrite-Republish' feature of the Yoast Duplicate Post plugin where drafts are created in the default language instead of the translated language, we have identified a couple of potential causes and solutions.
Solution:
1. When working with multiple language tabs, the language cookie is set to the language of the last tab opened. To avoid conflicts:
- We recommend not opening multiple language tabs simultaneously. If necessary, use different browsers for different languages (e.g., Chrome for English and Firefox for Italian).
2. If using the 'All languages' filter in the page list, drafts opened from this view will default to the site's main language.
- To ensure drafts are created in the correct language, select the specific language (e.g., Italian) in the page list before using the Rewrite & Republish feature.

Please note that these solutions might become outdated or may not directly address your specific issue. 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 these steps do 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.

Tagged: 

This topic contains 9 replies, has 0 voices.

Last updated by antonioN-6 9 months, 3 weeks ago.

Assisted by: Itamar.

Author Posts
June 23, 2025 at 11:49 am #17159763

antonioN-6

Background of the issue:
I am trying to use the 'Rewrite-Republish' feature of the Yoast Duplicate Post plugin on a translated page that was independently translated using the WPML plugin. I expected the draft to maintain the translated language of the original page. Link to a page where the issue can be seen: hidden link. More details can be found at hidden link and https://wpml.org/plugin/yoast-duplicate-post/. Environment: WordPress version 6.8.1, theme: twenty-five version 1.2, plugins: sitepress-multilingual-cms version 4.7.6, duplicate-post version 4.5.

Symptoms:
When I initiate a 'Rewrite-Republish' from a translated page, it creates a draft in the default language of the website instead of the translated language. This behavior is inconsistent and can lead to overwriting the correct translated page with the default language content, altering URLs, and potentially losing important settings associated with the translated page/post.

Questions:
How can I ensure that the 'Rewrite-Republish' feature maintains the translated language of the original page?
Is there a way to fix the language issue when creating a draft using the 'Rewrite-Republish' feature?

June 24, 2025 at 8:31 pm #17166820

Itamar
WPML Supporter since 02/2016

Languages: Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi,

We need to replicate this issue on a fresh WordPress installation. Then I'll be able to escalate it to our compatibility team. To achieve this, I created a test website with a clean WordPress installation. You can access it through this link:

hidden link

With this link, you'll be directly logged in.

Could you please install the Yoast Duplicate Post plugin and see if the issue is replicable on a clean WordPress installation?
Please configure WPML as it is set on your site (just the basic configurations needed to replicate the issue are sufficient).

Please also make sure that you are installing the latest version of the plugin.

When everything is finished and you can replicate the problem, please let us know.

Important! Do not import your site to the test site. We must replicate the problem on a fresh, clean WordPress installation.

Regards,
Itamar.

June 25, 2025 at 8:22 am #17167588

antonioN-6

Hi, thank you so much for your reply!
We reproduced the issue in the sandbox site.
As you can see in the sandbox, there is a test page published in primary and secondary language (classic translation editor) but the 'rewrite republish draft' of the secondary language is in the primary language.

We can produce more information or tests, if you need it.

In order to investigate the issue we noticed that sometimes it can't be reproduced.
It could be somehow related to actions done by the user, before the click on the 'rewrite republish' button.
Maybe it's related to the cookies? i.e. wp_lang? In fact, sometimes this cookie is unset.

We notice that in some part of the YOAST Duplicate post plugin, the author took care of WPML integration (i.e. file /duplicate-post/compat/wpml-functions.php)
And we notice that WPML plugin puts a lot of effort into ensuring compatibility with other great plugins.

We are not sure if the issue can be fixed in the duplicate-post plugin or in the WPML plugin? or with a work by both sides.

We opened the issue into the Yoast post-duplicate forum too.
https://wordpress.org/support/topic/incorrect-wpml-language-in-rewrite-republish-yoast-duplicate-plugin/

Thank You

June 25, 2025 at 12:40 pm #17169248

Itamar
WPML Supporter since 02/2016

Languages: Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi,

Thanks for reproducing the problem on the sandbox site. However, I was unable to replicate it on the sandbox site. When escalating an issue to our second-tier support team, I must provide them with the steps to reproduce the issue. I know you said it does not happen every time. But I tried it in many ways. Here is one way I tried:

1. I created the page in English.
2. I translated it into Italian with the WordPress editor.
3. I clicked the Rewrite and Republish option. Please see the attached screenshot.
4. I noticed it was ok and no new page was created in English.

I also tried by first creating the page in Italian and translating it into English. And also when the page was duplicated (WPML duplicate option) into another language.

Could you please specify the steps to reproduce the problem?

It would be great if you could share a video with me of the problem. You can use the free online screencast service Komodo - hidden link.

Regards,
Itamar.

2025-06-25_15-23-37.jpg
June 26, 2025 at 9:46 am #17172588

antonioN-6

Thank you for your patience and for your instructions!
I think I went deeper into the issue, with the next informations:
as you can see by the 4 recording, the issue is reproducible in, at least, 4 cases, but we can find more, because it's related to the session cookies, and the session cookies can be changed in a lot of cases):

(I recorded and uploaded 4 screen records in a drive folder, but if you need it, i can use external services like komodo, let me know it)

link to the drive folder of the record:
hidden link

- wpml-rewrite-issue-1 :
hidden link
If the user interact with other pages of the website (i.e. with other tabs) he could change the cookies (wp-wpml_current_admin_language and wp-wpml_current_language) and so the button 'rewrite republish' in the 'edit page' will create a draft in the wrong language (with possibly disruptive effects like wrong parent, url change, overwriting of content in the wrong language, and so on.)

- wpml-rewrite-issue-2 : as in recorded case 1, but with opposite languages.
hidden link
If the user interact with other tabs in the secondary language (italian), changing the session cookies, and he click on the previously opened edit page in english, the rewrite republish that should be in the primary (english) language will be created in the wrong (secondary/italian) language.

- wpml-rewrite-issue-3 :
hidden link
if the user is viewing the list page selecting the 'all language' filter,
the wp-wpml_current_admin_language cookie is set to 'all' and with the click in the 'rewrite republish' button from the list page he will create a draft in the wrong language.

Monitoring the cookies we can find easily other cases, for instance
- wpml-rewrite-issue-4 : if the user login and goes directly to the edit page
hidden link
if the user login and goes directly to the edit page link (without the lang= parameter in the url), the page language is ignored, the default language is used for the new draft of the rewrite republish button.

June 26, 2025 at 6:47 pm #17175010

Itamar
WPML Supporter since 02/2016

Languages: Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi,

I requested access to the GD folders. Please approve.

Thanks,
Itamar.

June 26, 2025 at 6:52 pm #17175018

antonioN-6

Hi,
My apologies for the GD blocked access.
I’ve now granted access to the files.
Thanks.

June 29, 2025 at 7:29 pm #17180835

Itamar
WPML Supporter since 02/2016

Languages: Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi,

You only opened the GD for wpml-rewrite-issue-3. However, I was able to replicate the issue with this scenario. I'll esclate this to our second-tier supporters and keep you updated here.

I appreciate your patience.
Itamar.

June 30, 2025 at 2:34 pm #17185064

Itamar
WPML Supporter since 02/2016

Languages: Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi,

This issue is now escalated to our compatibility team. We'll keep you updated on any news regarding this issue.

I appreciate your patience.
Itamar.

July 8, 2025 at 1:34 pm #17214275

Itamar
WPML Supporter since 02/2016

Languages: Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+03:00)

Hi,

Here are our second-tier supporter's findings about this case.

Regarding opening multiple tabs in different languages.

When you open several tabs in different languages, the language cookie is set to the language of the last tab you opened. This is expected behavior since the cookie can only hold one value at a time.
Workaround: We recommend not opening multiple language tabs at once. If you really need to work with, for example, English and Italian simultaneously, you can use two different browsers (e.g., Chrome for English and Firefox for Italian). This way, each browser keeps its own language cookie and avoids conflicts.

Regarding using the "All languages" filter
When you select "All languages" in the page list, you’re not in any specific language context. As a result, opening a draft from this view will default to the site’s main language (in this case, English).
Workaround: To avoid this, we suggest selecting the specific language (e.g., Italian) in the page list before clicking Rewrite & Republish. This ensures the draft is created in the correct language.

Regards,
Itamar.

July 9, 2025 at 9:03 am #17217779

antonioN-6

Thank you for your thorough investigation and the suggested workarounds.
We believe a more robust solution could be developed within the rewrite-republish function, though it may be outside the scope of the WPML plugin and more closely related to the Yoast Duplicate Post plugin.

Furthermore, it would be extremely valuable to document this issue and its resolution within the WPML website’s documentation – particularly on the FAQs or compatibility page.

This would help other users experiencing similar problems. Thank you again for your assistance.