Skip Navigation

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

Problem:
If you're experiencing issues where repeater fields are not displayed when filled in a translated language on your site, this could be due to the setup of your translation configuration. Specifically, if a page is created in one language and then copied to another, with repeater fields added only in the translated version, these fields might not show up as expected.
Solution:
We recommend ensuring that you are using the ACFML addon and have set the field group mode to 'Different fields across languages'. It's crucial to use the

wpml_object_id

hook to retrieve the correct post ID in the translated language. Here’s a step-by-step guide on how to implement this:

<?php<br />$repeater_field = 'rep'; // Change this to your repeater field name<br />$text_sub_field = 'text'; // Change this to your text field inside the repeater<br />$translated_post_id = apply_filters('wpml_object_id', get_the_ID(), 'post');<br />if (have_rows($repeater_field, $translated_post_id)) {<br />    echo '<ul>'; // Start a list for better formatting<br />    while (have_rows($repeater_field, $translated_post_id)) {<br />        the_row();<br />        $text_value = get_sub_field($text_sub_field);<br />        if ($text_value) {<br />            echo '<li>' . esc_html($text_value) . '</li>';<br />        }<br />    }<br />    echo '</ul>'; // Close the list<br />} else {<br />    echo '<p>No data available.</p>';<br />}<br />?>

For more details on using the

wpml_object_id

hook, please visit https://wpml.org/wpml-hook/wpml_object_id/.

If this solution does not resolve your issue, or if it seems outdated or irrelevant to your specific case, 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 further assistance is needed, please open a new support ticket at our support forum.

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 3 replies, has 0 voices.

Last updated by Dražen 1 month, 1 week ago.

Assisted by: Dražen.

Author Posts
March 14, 2025 at 1:24 pm #16816975

lawrenceA-3

Background of the issue:
I have a page in my theme with several repeaters, but the data won't be shown even if I can see it's there on the page and in the database. I found out the issue is that the repeater wasn't filled yet in the language that was added first. So if a page is created in English first, then copied to Dutch and there the repeater is added, it won't show. And the other way around too if Dutch is created first and then something is added in English. I tried explicitly giving along the page id, but that doesn't help either and it is the right ID.

Symptoms:
The fields in the repeater are not shown when filled in a translated language. I expected to see the fields shown in the repeater, but instead, I got nothing.

Questions:
Why are the repeater fields not showing when filled in a translated language?
Is there an issue with retrieving translations or translations only being in one place?

March 18, 2025 at 10:31 am #16829295

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

thanks for contacting us.

I just tried and it works fine, it could the due to your code. Make sure you are using the ACFML addon, wpml_object_id hook and have set field group mode to Different fields across languages.

Test page to check:
- hidden link
- hidden link

Code that I have used:

		<?php
// Define your repeater field name and subfield name
$repeater_field = 'rep'; // Change this to your repeater field name
$text_sub_field = 'text'; // Change this to your text field inside the repeater

// Get the current post ID in the correct WPML language
$translated_post_id = apply_filters('wpml_object_id', get_the_ID(), 'post');

// Get the repeater field values
if (have_rows($repeater_field, $translated_post_id)) {
    echo '<ul>'; // Start a list for better formatting
    while (have_rows($repeater_field, $translated_post_id)) {
        the_row();
        $text_value = get_sub_field($text_sub_field);

        if ($text_value) {
            echo '<li>' . esc_html($text_value) . '</li>';
        }
    }
    echo '</ul>'; // Close the list
} else {
    echo '<p>No data available.</p>';
}
?>

Regards,
Drazen

March 21, 2025 at 7:29 am #16842833

lawrenceA-3

Thanks, I'll give it a try when I get to it.

Do I always have to use the translated_post_id? Until now I only had to use it if I wanted to get a string from a different language.

March 21, 2025 at 7:37 am #16842847

Dražen
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+02:00)

Hello,

yes, you need to use wpml_object_id hook to get translated IDs for post, taxonomy and etc.

- https://wpml.org/wpml-hook/wpml_object_id/

Regards,
Drazen