WPML
Status
Resolved
Reported for
WPML Multilingual CMS 4.6.9
Resolved in
WPML 4.9.3
Topic tags
Bug

Overview of the issue

In some cases, when using custom page templates, the selected template is not correctly applied to translated pages.

Workaround

To ensure the custom page template is correctly applied to the translated page, follow these steps:


  • Delete the relevant entries from both the wp_posts and icl_translations tables.
OR

  • Switch to the secondary language using the top admin bar, then go to Appearance > Editor, locate the translated template, and delete it.

  • In WPML > Settings > Page URL, enable “Translate” for Slug Translation (this ensures the template slug is included in the translation instead of being auto-generated from the title).

  • Open the file: wp-content/plugins/sitepress-multilingual-cms/classes/full-site-editing/BlockTemplates.php

  • Around line 56, comment out the following line:
    $postData['post_name'] = $post->post_name;


  • Resend the template for translation.

  • When translating the template, make sure the slug is correct and includes the translated page or taxonomy slug.

Edge‑case scenario


There is a specific sequence in which a translated page may not be associated with the translated template:

  • When you create a new custom template directly while creating a new page (by selecting “Template > Create a new template” in the right sidebar), both the page and its template are published simultaneously.

  • If automatic translation (”Translate everything“) is enabled, WPML sends both the page and the template to translation at the same time.

  • If the page translation completes before the template translation, the translated template does not yet exist to be assigned. So the translated page ends up with the default template instead.

  • To resolve this, once the template translation is completed and published, resend the translated page to translation so it correctly receives the newly translated template.

All known issues →