Skip Navigation

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.

Sun Mon Tue Wed Thu Fri Sat
10:00 – 14:00 10:00 – 14:00 10:00 – 14:00 10:00 – 14:00 10:00 – 14:00 - -
16:00 – 20:00 16:00 – 20:00 16:00 – 20:00 16:00 – 20:00 16:00 – 20:00 - -

Supporter timezone: Asia/Jerusalem (GMT+03:00)

This topic contains 15 replies, has 1 voice.

Last updated by Itamar 2 days, 9 hours ago.

Assisted by: Itamar.

Author Posts
April 16, 2025 at 10:36 am

markusN-7

Background of the issue:
I have created a custom FSE block and attached ACF to select pages. These pages should be displayed in the respective translation on the page where the block is included. This worked correctly for the initial translation. However, for every new automatic translation of this page, the pages are displayed in the source language. I have to manually reorder the selected pages in the ACF for each translated page to display the translations correctly. The issue can be seen at: hidden link.

Symptoms:
The selected pages are displayed in the source language instead of the correct translation for every new automatic translation.

Questions:
Why are the pages displayed in the source language for new automatic translations?
How can I ensure the selected pages are displayed in the correct translation automatically?

April 20, 2025 at 4:26 pm #16950049

Itamar
WPML Supporter since 02/2016

Languages: English (English ) Hebrew (עברית )

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

Hi,

Please try my colleague's suggestion and get back to us if you need further help with this issue.

Regards,
Itamar.

April 24, 2025 at 8:54 am #16963301

markusN-7

Hello,

Unfortunately, following the suggestions is not possible. The ACF do not show up in the Toolbox settings, so i cannot create the config file.
We added ACF via code, and according to ACF docs, fields added via code do not show up in the backend. But shouldn't find WPML them anyway?

Thanks,
regards

April 24, 2025 at 9:15 pm #16966380

Itamar
WPML Supporter since 02/2016

Languages: English (English ) Hebrew (עברית )

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

Hi,

I need some more information about this case, please. For some unknown reason, the chat you had with Waqas, my colleague, has been removed from this ticket. I remember seeing it the first time I replied to you. I apologize if that issue occurred due to an error in our system.

I have access to your site.
Can you please tell me where I can see the code that adds the ACF fields?

Please note that my weekend is Friday-Saturday, and I'll be able to continue to check this issue and help you on Sunday.

I appreciate your patience.

Regards,
Itamar.

April 25, 2025 at 8:30 am #16967367

markusN-7

Hi Itamar,

Thank you for the late update and the information.

Waqas suggested to apply the information here https://wpml.org/documentation/support/language-configuration-files/make-custom-gutenberg-blocks-translatable/ to my custom block, but i am not able to generate the config file in the first place.

The code of the relevant ACF would be this, and the issue is with the 'Items' field:
acf_add_local_field_group([
'key' => '...',
'title' => 'Block | Magical Journey',
'fields' => [
[
'key' => '...',
'label' => 'Title',
'name' => 'title',
'aria-label' => '',
'type' => 'text',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => [
'width' => '',
'class' => '',
'id' => '',
],
'wpml_cf_preferences' => 2,
'default_value' => 'Die magische Reise',
'maxlength' => '',
'allow_in_bindings' => 1,
'placeholder' => '',
'prepend' => '',
'append' => '',
],
[
'key' => '...',
'label' => 'Items',
'name' => 'items',
'aria-label' => '',
'type' => 'relationship',
'instructions' => '',
'required' => 1,
'conditional_logic' => 0,
'wrapper' => [
'width' => '',
'class' => '',
'id' => '',
],
'wpml_cf_preferences' => 2,
'post_type' => [
0 => 'page',
],
'post_status' => [
0 => 'publish',
],
'taxonomy' => '',
'filters' => [
0 => 'search',
1 => 'taxonomy',
],
'return_format' => 'id',
'min' => 4,
'max' => 9,
'allow_in_bindings' => 1,
'elements' => [
0 => 'featured_image',
],
'bidirectional' => 0,
'bidirectional_target' => [],
],
],
'location' => [
[
[
'param' => 'block',
'operator' => '==',
'value' => 'ttvie/magical-journey',
],
],
],
'menu_order' => 0,
'position' => 'normal',
'style' => 'default',
'label_placement' => 'top',
'instruction_placement' => 'label',
'hide_on_screen' => '',
'active' => true,
'description' => '',
'show_in_rest' => 0,
'acfml_field_group_mode' => 'advanced',
]);

This is my custom block's block.json:
{
"$schema": "hidden link",
"apiVersion": 3,
"name": "ttvie/magical-journey",
"title": "Magical Journey",
"category": "",
"icon": "text",
"description": "",
"keywords": [],
"version": "1.0.0",
"textdomain": "ttvie",
"supports": {
"anchor": true,
"align": false,
"alignWide": false,
"ariaLabel": false,
"html": false,
"layout": false,
"inserter": true,
"multiple": false,
"reusable": true
},
"style": "file:./magical-journey.css",
"acf": {
"mode": "preview",
"renderCallback": "spwkRenderAcfBlock"
}
}

The 'spwkRenderAcfBlock' renderCallback basically takes the IDs of the via the ACF selected pages, reads their data, and prints it.

Thank you for checking. Let me know, if you need anything else.

Regards

April 28, 2025 at 8:06 pm #16976668

Itamar
WPML Supporter since 02/2016

Languages: English (English ) Hebrew (עברית )

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

Hi,

I'm sorry for the late reply here.

Thanks for providing all the additional details.

Please try the following:

1. Go to WPMl -> Settings -> Custom XML Configuration (tab).

2. Insert this code:

<wpml-config>
  <custom-fields>
    <custom-field action="copy">title</custom-field>
    <custom-field action="copy">items</custom-field>
  </custom-fields>
  <custom-types>
    <custom-type translate="1">ttvie/magical-journey</custom-type>
  </custom-types>
</wpml-config>

3. Save the changes.

4. Try re-translating a page using your custom block and check if the related pages are now correctly set to the translation.

Notes about the XML code: 'title' and 'items' are the field names exactly as you defined them in acf_add_local_field_group. We tell WPML to copy these fields during translation. For the relationship field (items), copying the field enables WPML to sync the related page translations correctly during automatic translation.

Please let me know how it goes.

Regards,
Itamar.

May 5, 2025 at 4:50 pm #16997432

markusN-7

Hi,

Thank you and sorry for the late reply, too.
I tried your suggestion, but unfortunately, it did not change anything.
Is there anything else, you or we can try?

Thanks,
regards

May 6, 2025 at 8:43 am #17000218

Itamar
WPML Supporter since 02/2016

Languages: English (English ) Hebrew (עברית )

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

Hi,

Please note that only adding the XML in WPML -> Settings -> Custom XML Configuration will not solve the problem immediately if:

A. The translation of the page needed an update (circular arrow icon).
B. The translation of the page was in-progress (gear icon).

In this case, you would need to complete the translation first. Then you would need to update the original page, which will cause an update to the translation. Then you need to update the translations.

I wanted to check the homepage to see if this was the case, but I got a message that you are editing this page. Please see the attached screenshot. So I did nothing and left this page, not to break any of your edits.

Regards,
Itamar.

2025-05-06_11-36-30.jpg
May 6, 2025 at 8:58 am #17000362

markusN-7

Hi,

Sorry for blocking the site, you can check yourself anytime now.

I tried these steps yesterday:
1. Fixed the chinese translation manually.
2. Changed in the german origin a little text (below the first 4 icons)
3. Checked in WPML Translation Management whether the auto-translation kicked in
4. As it did not for all translations, i waited until the ones that got translated were ready and sent the ones, that werent automatically translated to the translations service via the buttons on the bottom of that page.
5. I waited until all icons for the home page showed the green checkmark
6. Checked the chinese translation in the frontend and found, that the cards were again in the source language

Regards

May 7, 2025 at 9:33 am #17005328

Itamar
WPML Supporter since 02/2016

Languages: English (English ) Hebrew (עברית )

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

Hi,

As far as I can tell, it worked.

I just checked the Chienes homepage here hidden link.
I clicked the links, for example, 5D Kino, and I got hidden link. Please see the attached screenshot.

Maybe it was a caching issue that was cleared by now.

Can you please confirm the issue is fixed now?

Thanks,
Itamar.

2025-05-07_12-24-54.jpg
May 8, 2025 at 6:47 am #17009911

markusN-7

Hi,

You are right, the link is correct, but the headline and text in each card before the link should also be displayed translated. Unfortunately, this still does not work.
I also tried clearing all relevant server caches, but with no success.

Thank you,
Regards

May 8, 2025 at 3:21 pm #17012811

Itamar
WPML Supporter since 02/2016

Languages: English (English ) Hebrew (עברית )

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

Hi,

I see, indeed, the text is not translated.

When I edit the German homepage, I see a list of pages inside a Megical Journey block. However, the text I see on the frontend is not in this block. Please see the attached screenshot. Please explain to me where this text is coming from and how you are displaying it on the frontend.

Please note that my weekend is Friday-Saturday, and I'll be able to continue to check this issue and help you on Sunday.

Regards,
Itamar.

2025-05-08_18-12-01.jpg
May 9, 2025 at 1:20 pm #17016866

markusN-7

Hi,

this is simply for a better experience for editors, so that there is a simpler interface.
We do this by simply printing the information differently out on the screen, whether it is displayed in front- or backend. However, the method of gathering these information is the same in both cases. I attached a screenshot of the simplified code. The sample is a twig-template (hidden link), field.items holds the array of post IDs as returned by ACF and the relevant get_post function is provided by Timber (hidden link), which is basically just a wrapper around WordPress' global 'get_post' function.

Thank you,
Regards

Bildschirmfoto 2025-05-09 um 15.03.48.png
May 11, 2025 at 7:50 am #17019743

Itamar
WPML Supporter since 02/2016

Languages: English (English ) Hebrew (עברית )

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

Hi,

I understand now that you are using the Timber plugin to implement this. (You are using a multisite WordPress installation, and probably Timber is activated on the network level. This is why I could not see that you are using this plugin.) The Timber plugin is officially compatible with WPML: https://wpml.org/plugin/timber/. However, you have custom code (probably in your custom theme). It is hard for me to work with the code, and hopefully, provide a workaround as you shared in a screenshot. I may also need to consult our second-tier supporters and compatibility team about this case. So it would be best to recreate this problem on a fresh WordPress installation. (For simplicity, please only add the block in question.) For this, I created a test website with a clean WordPress install. You can access it through this link:

hidden link

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

Could you please install the Timber plugin, add your custom code, and see if the issue is replicable on a clean WordPress installation?

Please configure WPML as set on your site (just the basic configurations needed to replicate the issue are enough).

Please also ensure you install the latest version of the plugin.

Also, please explain where your custom code is located.

Please let us know when everything is finished and you can replicate the problem.

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

Regards,
Itamar.

May 12, 2025 at 4:40 pm #17024072

markusN-7

Hi,

is there a way to access this sandbox directly via FTP?
The FileManager plugins are not very flexible, and the whole site cannot be accessed anymore, if an uploaded php file contains an error. I cannot finish the setup, unfortunately, and i cannot fix my mistake either.

Regards