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
- - 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00
- - - - - - -

Supporter timezone: America/Lima (GMT-05:00)

Tagged: 

This topic contains 2 replies, has 0 voices.

Last updated by Andreas W. 3 months ago.

Assisted by: Andreas W..

Author Posts
February 18, 2025 at 11:54 pm #16721341

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Could you please give this a try and let me know if this solves the issue?

// Check if rows exist.
if( have_rows('test_repeater_taxonomy') ):

    // Loop through rows.
    while( have_rows('test_repeater_taxonomy') ) : the_row();

        // Load sub field value (assumes it's storing a taxonomy term ID).
        $term_id = get_sub_field('repeater_taxonomy_field');

        if( $term_id ) {
            // Get the current WPML language.
            $current_lang = apply_filters( 'wpml_current_language', null );

            // Get the translated term ID in the current language.
            $translated_term_id = apply_filters( 'wpml_object_id', $term_id, 'product-feature', true, $current_lang );

            // Get term details in the translated language.
            $term = get_term( $translated_term_id, 'product-feature' );

            if( ! is_wp_error($term) && ! empty($term) ) {
                // Escape and display translated term name safely.
                echo esc_html( $term->name );
            } else {
                echo esc_html__( 'Translation not found', 'textdomain' );
            }
        }

    // End loop.
    endwhile;

// No value.
else :
    echo esc_html__( 'No terms found', 'textdomain' );
endif;

This workaround yet would only work for product features. Please let me know in case this fixes the issue.

February 19, 2025 at 12:59 am #16721446

Noothan Mathew

Hi,

Sorry, it didnt.

It failed at this step -

// Get the translated term ID in the current language.
$translated_term_id = apply_filters( 'wpml_object_id', $term_id, 'product-feature', true, $current_lang );

Here is the full code I used to test:

$test = array(48880,48881);

if (in_array($post->ID, $test)) {
echo 'test_taxonomy<br>';

$post_id = $post->ID;
$wpml_post_id = apply_filters( 'wpml_object_id', $post_id, 'page' );

$taxonomy = get_field('test_taxonomy', $wpml_post_id);

print_r($taxonomy);

echo '<br>test_taxonomy_repeater<br>';

if( have_rows('test_repeater_taxonomy') ):

// Loop through rows.
while( have_rows('test_repeater_taxonomy') ) : the_row();

// Load sub field value (assumes it's storing a taxonomy term ID).
$term_id = get_sub_field('repeater_taxonomy_field');
// Get the current WPML language.
$current_lang = apply_filters( 'wpml_current_language', null );

if( $term_id && $current_lang !== 'en') {

// Get the translated term ID in the current language.
$translated_term_id = apply_filters( 'wpml_object_id', $term_id, 'product-feature', true, $current_lang );

// Get term details in the translated language.
$term = get_term( $translated_term_id, 'product-feature' );

if( ! is_wp_error($term) && ! empty($term) ) {
// Escape and display translated term name safely.
echo esc_html( $term->name );
} else {
echo esc_html__( 'Translation not found', 'textdomain' );
}
} else {
echo 'English<br><br>';
print_r($term_id);
}

// End loop.
endwhile;

// No value.
else :
echo esc_html__( 'No terms found', 'textdomain' );
endif;

echo '<br><br><br>';

}

February 19, 2025 at 1:08 am #16721453

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Thank you for your confirmation!

Before I try to recreate this issue, could you please test if this workaround can fix the problem?

https://wpml.org/errata/advanced-custom-fields-taxonomy-fields-are-blank-in-secondary-languages/

February 19, 2025 at 1:17 am #16721456

Noothan Mathew

Applied the workaround, didnt help that either.

February 19, 2025 at 1:24 am #16721490

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Thank you!

I am sorry to hear that it does not work out and I suspect a new bug.

I will try to recreate this issue on a test site and then get back to you.

February 19, 2025 at 1:25 am #16721492

Noothan Mathew

Great, thank you.

I highly appreciate it, being new to wordpress and ACF I was in a puddle trying to get this sorted.

February 19, 2025 at 10:05 pm #16726912

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

I imported your CPTs and Field Groups to a test site and I can not confirm the issue here:
hidden link

Here is how I render the fields:

	$term = get_field('test_taxonomy');
			if( $term ): ?>
				<h2><?php echo esc_html( $term->name ); ?></h2>
				<p><?php echo esc_html( $term->description ); ?></p>
			<?php endif; 		

			// Check rows exists.
			if( have_rows('test_repeater_taxonomy') ):

				// Loop through rows.
				while( have_rows('test_repeater_taxonomy') ) : the_row();

					// Load sub field value.				
					$term = get_sub_field('repeater_taxonomy_field');
					
					if( $term ): ?>
						<h2><?php echo esc_html( $term->name ); ?></h2>
						<p><?php echo esc_html( $term->description ); ?></p>
					<?php endif; 

				// End loop.
				endwhile;

			// No value.
			else :
				echo "Unable to render field";
			endif;

Please go to Plugins > Add new > Commercial and update our plugins. After that, edit fields on the original page, save the page and apply the translation again.

If this will not solve the issue, please let me know.

February 23, 2025 at 6:23 pm #16738484

Noothan Mathew

Hi,

I have taken over a project that needs to be completed by mid-week, please leave this ticket open and I will get back to you in 4 days.

Thank you

February 25, 2025 at 3:08 pm #16746636

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

The ticket will remain open for a maximum of 14 days.

March 5, 2025 at 12:38 am #16776321

Noothan Mathew

Hi,

Thank you keeping the ticket open.

I did the updates as you suggested and the repeater fields are not pulling through in spanish still, also breaking the page.

I have attached screenshots of English and Spanish pages.

For testing, Please login to view - hidden link

I havent changed your testing credentials, but let me know if there is anything.

Screenshot 2025-03-05 at 1.36.06 PM.png
Screenshot 2025-03-05 at 1.35.34 PM.png
March 5, 2025 at 6:54 pm #16780386

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Could you please try this logic:

$term = get_field('test_taxonomy');
        if( $term ): ?>
            <h2><?php echo esc_html( $term->name ); ?></h2>
            <p><?php echo esc_html( $term->description ); ?></p>
        <?php endif;         
 
        // Check rows exists.
        if( have_rows('test_repeater_taxonomy') ):
 
            // Loop through rows.
            while( have_rows('test_repeater_taxonomy') ) : the_row();
 
                // Load sub field value.                
                $term = get_sub_field('repeater_taxonomy_field');
                 
                if( $term ): ?>
                    <h2><?php echo esc_html( $term->name ); ?></h2>
                    <p><?php echo esc_html( $term->description ); ?></p>
                <?php endif; 
 
            // End loop.
            endwhile;
 
        // No value.
        else :
            echo "Unable to render field";
        endif;

Remove the WPML Hooks that we added earlier. They are usually not required.

March 7, 2025 at 12:30 am #16785716

Noothan Mathew

Hi,

Thank you,

not sure what it is, the repeater fields are pulling the right values now. I wonder if it needed some time for the changes to take effect.

Anyway, I was doing more testing, started to put content on an acf component that is set up with nested repeater field types. And while working on it, I had to manually translate some acf taxonomies required via WPML -> taxonomy translation.

As in the screenshots below, I translated both the parent and child taxonomy term, but the translated taxonomy category is not retaining the parent relationship. When I output the term details the parent value is set to "0", what am I missing here? I have to go back into the taxonomy and edit to update the parent category back to who it originally was.

Precisely, my current problem statement is - WPML translated taxonomy category is not retaining the parent relationship, I tried multiple ones. The tests were done in a different environment, so you wont see this in the prod env I shared earlier. Please let me know if you need access to my testing environment.

Array
(
[0] => Array
(
[name] => test 1
[product_features] => Array
(
[0] => Array
(
[feature] => WP_Term Object
(
[term_id] => 10587
[name] => Data import and organization
[slug] => data-import-and-organization-es
[term_group] => 0
[term_taxonomy_id] => 10587
[taxonomy] => product-feature
[description] =>
[parent] => 0
[count] => 0
[filter] => raw
)

[feature_status] => True
[custom_text] =>
)

)

)

Thank you,

Screenshot 2025-03-07 at 1.24.48 PM.png
Screenshot 2025-03-07 at 1.22.34 PM.png
Screenshot 2025-03-07 at 1.22.26 PM.png
March 7, 2025 at 1:19 am #16785830

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

I can offer that we try to recreate this on a test site which I will provide but my first thought on this would be:

If you build a relation that for example would be based on for example

[name] => Data import and organization
[slug] => data-import-and-organization-es

then changing the name and slug of this taxonomy would be expected to break the current fields on the translated content until you update the translation of the page that is holding the field.

Could you please confirm if updating the translation of the page that is holding the fields solves the issue?

March 8, 2025 at 12:06 am #16790513

Noothan Mathew

Sorry, I think you didn't quite get what I was trying to do.

say for eg:

[name] => Gravity Loading initial calculation type
[slug] => gravity-loading-initial-calculation-type
[parent] => Acquisition workflows

For this existing relationship, when I use WPML taxonomy translation to add translated term for language 'ES', it is not retaining the parent relationship, it saves as below:

[name] => Gravity Loading initial calculation type ES
[slug] => gravity-loading-initial-calculation-type-es
[parent] => 0

To confirm, updating the translation of the page that is holding the fields doesnt solve the issue,. but manually editing the "ES" taxonomy term and adding the relevant parent solves the issue.

March 8, 2025 at 1:07 am #16790660

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Yes, the issue might be that you can not use the same slug for translated taxonomies.

The filtering is not working, as the translated taxonomy uses a different slug.

This seems to be related to the logic that you use to display the fields.

Take note, that when using the recommended way which I took from ACF's website the translated taxonomies showed up as expected:
https://wpml.org/forums/topic/acf-repeater-taxonomy-fields-are-not-showing-up-on-translation-editor-2/page/2/#post-16780386

If you still suspect a bug, I can offer a new test site on which you can upload your theme, create a post and taxonomies, and try to recreate the issue.

Would you agree don't hat?