Skip Navigation

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

Problem:
If you're experiencing issues where your custom FSE block with ACF on selected pages displays pages in the source language instead of the correct translation for every new automatic translation, this might be due to incorrect settings in your Twig templates and WPML configuration.
Solution:
We recommend checking your Twig template for the custom fields translation preference. It should be set to 'Copy' rather than 'Translate'. For example, change the

wpml_cf_preferences

from 2 to 1 in your ACF field settings like this:

{"key": "field_67a4a26e0b2fd", "label": "Items", "name": "items", "type": "relationship", "wpml_cf_preferences": 1}

Additionally, update your WPML settings by adding the following XML configuration to ensure the correct translation of post IDs within blocks:

<wpml-config><gutenberg-blocks><gutenberg-block type="ttvie/magical-journey" translate="0"><key name="data"><key name="title" /><key name="items"><key name="*" type="post-ids" /></key></key></gutenberg-block></gutenberg-blocks></wpml-config>

If this solution does not resolve your issue or seems outdated, 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 the problem persists, 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 22 replies, has 2 voices.

Last updated by Itamar 1 month, 2 weeks ago.

Assisted by: Itamar.

Author Posts
May 13, 2025 at 3:52 pm #17028929

Itamar
WPML Supporter since 02/2016

Languages: English (English )

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

Hi,

I'm sorry, but we don't have FTP access for those sandbox sites. Here is a new, fresh site you can use.

hidden link

Regards,
Itamar.

May 16, 2025 at 4:49 pm #17042906

markusN-7

Hi,

Thank you, i will try to set it up without breaking the site this time.
I'll get back to you when I'm done.

Regards

May 18, 2025 at 9:43 am #17045342

Itamar
WPML Supporter since 02/2016

Languages: English (English )

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

Hi,

Sure, thanks.

Please note that the sandbox site will be available for about one week if no one logs into it. If you need more than one week, please log in to it toward the end of the week to extend its lifetime for one week.

Regards,
Itamar.

May 19, 2025 at 3:09 pm #17049339

markusN-7

Hello,

Thanks for the advice, I managed to setup and reproduce the issue now.
I implemented it as a custom theme and reduced the code to the bare minimum.

Steps to reproduce:
First check the startpage in German and English, both show the title of the linked pages in the correct langauge.
Then:
1. Change a text in the German original (e.g. the number after "Beispieltext")
2. Send the page to the automatic translation via DeepL and wait until the page is done
3. Check the startpage in both languages and find, that the titles in EN are now also German and with mixed order.

To reset:
1. Go to the pages in the english backend and edit the page
2. Click on the block and wait until the ACF in the sidebar on the right loaded
3. See that the pages in the editor are also wrongly translated
4. In the sidebar, reorder the pages, this somehow restores the correct translations
5. Save the page

Please let me know, if there any questions.

Thank you,
best regards

May 21, 2025 at 7:49 am #17055436

Itamar
WPML Supporter since 02/2016

Languages: English (English )

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

Hi,

Thanks for replicating the issue on the sandbox site.
And thanks for the detailed steps on replicating the issue.
I could replicate it according to your steps.

Can you please tell us where in your theme's files the code for the 'Magical Journey' block is?

Thanks,
Itamar.

May 21, 2025 at 8:12 am #17055533

markusN-7

Hi,

Specific code for the block is located in the components/blocks/magical-journey directory. Timber is installed via composer, and its setup is in functions/timber.php. Block-registration and the render-function is in functions/blocks.php. ACF-json (for reference) is in acf/json/, the PHP-definition is in components/blocks/magical-journey/magical-journey.php.

Thank you,
Regards

May 21, 2025 at 8:42 pm #17059050

Itamar
WPML Supporter since 02/2016

Languages: English (English )

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

Hi,

Thanks a lot.

I'll escalate this issue and keep you updated.

I appreciate your patience.
Itamar.

May 27, 2025 at 5:27 pm #17080131

Itamar
WPML Supporter since 02/2016

Languages: English (English )

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

Hi,

Our second-tier supporter and compatibility developer looked at your issue. Here is what they have found.

In your Twig templates, you defined the custom fields translation preference as 2. For example, this field:

        {
            "key": "field_67a4a26e0b2fd",
            "label": "Items",
            "name": "items",
            "aria-label": "",
            "type": "relationship",
            "instructions": "",
            "required": 1,
            "conditional_logic": 0,
            "wrapper": {
                "width": "",
                "class": "",
                "id": ""
            },
            "wpml_cf_preferences": 2,
            "post_type": [
                "page"
            ],

However, it should be set as 1, which means Copy. It should be like this:

            "key": "field_67a4a26e0b2fd",
            "label": "Items",
            "name": "items",
            "aria-label": "",
            "type": "relationship",
            "instructions": "",
            "required": 1,
            "conditional_logic": 0,
            "wrapper": {
                "width": "",
                "class": "",
                "id": ""
            },
            "wpml_cf_preferences": 1, // 1: COPY (instead of 2)
            "post_type": [
                "page"
            ],

Also in WPML -> Settings -> Custom XML Configuration, you should add the following XML:

<wpml-config>
  <gutenberg-blocks>
    <gutenberg-block type="ttvie/magical-journey" translate="0">
      <key name="data">
        <key name="title" />
        <key name="items">
          <key name="*" type="post-ids" />
        </key>
      </key>
    </gutenberg-block>
  </gutenberg-blocks>
</wpml-config>

This should solve the problem.

Please check and confirm.

Regards,
Itamar.