[Resolved] Translate a custom block with ACF attached
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
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.
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.
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
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?
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.