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.

Elementor users - please update WPML to the latest version to maintain compatibility. More details here - https://wpml.org/changelog/2024/12/wpml-4-6-15-critical-update-for-elementor-sites/
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)

This topic contains 70 replies, has 2 voices.

Last updated by Andreas W. 1 month, 3 weeks ago.

Assisted by: Andreas W..

Author Posts
October 2, 2024 at 8:25 pm #16247392

ruiG-5

Background of the issue:
I am trying to determine if there is some sort of cache when I change ACF fields in expert mode. I am asking because I have been changing things, but they don't show when I go to edit the translation using the advanced translation editor.

Symptoms:
I expected to see the fields that I have changed in the ACF expert mode, but I am still seeing the same fields even after clearing all caches.

Questions:
Is there some sort of cache when I change ACF fields in expert mode?

October 2, 2024 at 11:19 pm #16247618

Andreas W.
Supporter

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

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

Hello,

After changing the setting you will currently need to edit the field again and then open the WPML Translation Editor.

We provided a workaround for this issue in this errata:
https://wpml.org/errata/changing-translation-preferences-for-custom-fields/

Best regards
Andreas

October 2, 2024 at 11:23 pm #16247619

ruiG-5

Damn. I'm guessing I'll have to add changed fields to this query. Can you confirm?

October 3, 2024 at 12:02 am #16247664

Andreas W.
Supporter

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

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

This code is just a one time use purpose. It should not be active all the time.

Example for a post that includes the ACF field name "simple_field" inside the config variable:

add_action('wp', function(){
    $config = [
        'post_type' => 'post', //Post type slug
        'meta_key_name' => 'simple_field' //Custom field key
    ];
    
    if (!isset($_GET['wpml_sync'])) {
        return;
    }
    
    set_time_limit(0);
    do_action('wpml_switch_language', apply_filters( 'wpml_default_language', null ));
    $all_posts = get_posts([
        'post_type' => $config['post_type'],
        'posts_per_page' => -1,
        'suppress_filters' => false
    ]);
    
    if (empty($all_posts)) {
        return;
    }
    
    foreach ($all_posts as $post) {
        do_action( 'wpml_sync_custom_field', $post->ID, $config['meta_key_name'] );
    }
    
    wp_die('Done!');
});

- Visit your website and add this to your URL: /?wpml_sync (e.g.
hidden link)
- Remove the code from your file

I did not test yet how it would behave if you use arrays of post types and fields.

October 7, 2024 at 3:20 pm #16262453

ruiG-5

Doesn't do the trick mate. Check attachments.

Screenshot_11.jpg
Screenshot_12.jpg
Screenshot_6.jpg
Screenshot_7.jpg
Screenshot_8.jpg
Screenshot_9.jpg
Screenshot_10.jpg
October 7, 2024 at 6:08 pm #16263231

Andreas W.
Supporter

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

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

The 'meta_key_name' refers here to the field name, like for example "button".

Fields like "Group", "Repeater", or other Layout Fields alsways need to be set to "Copy", so that the subfields will be available.

If you use the Expert mode for the field settings, please make sure to follow this guide:
https://wpml.org/documentation/related-projects/translate-sites-built-with-acf/recommended-custom-fields-translation-preferences-for-acf-and-wpml/

Basically there are two modes for each field group which will adjust the mentioned settings automatically. Important to understand is:

"Same fields across languages" is the settings to use when translating the fields with the WPML Translation Editor.

This means, also in Expert mode, you should use those settings as reference when translating the fields with the WPML Translation Editor.

October 8, 2024 at 1:51 pm #16265716

ruiG-5

Ok. I have changed all ACF fields to match - in any case, groups can be selected as "don't translate", still works tho.

Check attachments. I have used this code as well, but still not working.

add_action('wp', function(){
$config = [
'post_type' => 'page', //Post type slug
'meta_key_name' => 'link' //Custom field key
];

if (!isset($_GET['wpml_sync'])) {
return;
}

set_time_limit(0);
do_action('wpml_switch_language', apply_filters( 'wpml_default_language', null ));
$all_posts = get_posts([
'post_type' => $config['post_type'],
'posts_per_page' => -1,
'suppress_filters' => false
]);

if (empty($all_posts)) {
return;
}

foreach ($all_posts as $post) {
do_action( 'wpml_sync_custom_field', $post->ID, $config['meta_key_name'] );
}

wp_die('Done!');
});

I'm not sure if you can access, but this the advanced translation URL: hidden link

Screenshot_13.jpg
Screenshot_14.jpg
Screenshot_15.jpg
Screenshot_16.jpg
October 9, 2024 at 12:05 pm #16269922

Andreas W.
Supporter

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

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

Could this be related to the fact that the field name "link" is used more than once inside ACF?

You might experience issues if the same field name is used more than once inside the same ACF Group or even between different groups.

This will lead to missing entries on the WPML Translation Editor.

Source (see notice at end of this section):
https://wpml.org/documentation/related-projects/translate-sites-built-with-acf/#using-same-fields-across-languages

October 9, 2024 at 1:44 pm #16270701

ruiG-5

I have a repeater field and inside one field name called "link". In this block there isn't any other field called "link".

October 9, 2024 at 4:53 pm #16271823

Andreas W.
Supporter

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

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

The rule applies for all ACF Fields, in all your blocks or field groups.

Notice from documentation:
Make sure each of the custom fields across your different field groups has a unique Field Name. If you use the same Field Name with more than one custom field, you may not see all your field values available for translation in the Advanced Translation Editor.

Please verify if this is the case.

October 9, 2024 at 5:04 pm #16271845

ruiG-5

In any case that's not my issue. My issue remains having fields available to translate when I've explicitly choosen to copy or don't translate.

October 9, 2024 at 5:57 pm #16271960

Andreas W.
Supporter

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

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

Sorry for the misunderstanding.

It might be the case, that the fields still show up as the translation job was started before the field setting was changed.

Go to WPML > Translation Management > Jobs to cancel the current job.

Then open the WPML Translation Editor again.

Does this solve the issue?

October 11, 2024 at 11:09 am #16279063

ruiG-5

Doesn't work. Still having the same issue.

October 11, 2024 at 4:55 pm #16280826

Andreas W.
Supporter

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

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

Hello,

I would like to offer to have a closer look at the problem and request temporary access (wp-admin and FTP) to the website to investigate this issue further.

You can find the required fields below the comment section when you log in to leave the next reply. The information you provide is private, which means only you and I can see and access it.

IMPORTANT
Please be sure to make a backup copy of the website and database before allowing us access.
If you can't see the wp-admin / FTP fields, your post and website credentials are set as PUBLIC. DO NOT publish the data unless you see the required wp-admin / FTP fields.

The private response form looks like this:
hidden link

Next time you reply, click "I still need assistance."

Video:
hidden link

Please note that we are obliged to request this information individually on each ticket. We may not access any access information not specifically submitted on this ticket in the private response form.

Best regards
Andreas

October 14, 2024 at 11:39 am #16285728

Andreas W.
Supporter

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

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

My apologies if I repeat myself, as I had mentioned this earlier:

Each field name in each group should be unique.

You use for example the field name "title", "content", "button", etc. in different field groups and this is not recommended, as it can lead to unexpected issues when trying to translate those fields.

Fields that should not appear on the WPML Translation Editor should be set to "Copy".