Skip Navigation

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

Problem:
You are trying to translate a dynamically populated ACF field using the ACFML plugin, but the field is not translating or appearing in the other language.
Solution:
1. Verify that your ACF Select Field has Choices set. If no Choices are declared, WPML cannot translate them using the WPML Translation Editor because the values are set through custom code.
2. To translate such fields, use the WPML String Translation. You can register the strings for translation using a GetText call in PHP or by utilizing the WPML hook: https://wpml.org/wpml-hook/wpml_register_single_string/
3. For additional guidance on translating themes and plugins you've created, refer to: https://wpml.org/documentation/support/translating-the-theme-you-created/

If this solution does not apply to your case, or if it seems outdated, we recommend opening a new support ticket. We also 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. For further assistance, please visit our support forum: WPML 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 6 replies, has 1 voice.

Last updated by Andreas W. 1 week, 1 day ago.

Assisted by: Andreas W..

Author Posts
January 11, 2025 at 4:24 pm #16584329

sherazA-3

Background of the issue:
I am trying to translate a dynamically populated ACF field on my site hidden link. I am using the ACFML plugin to achieve this.

Symptoms:
The dynamically populated ACF field is not translated in the other language, and it is not selected in the other language.

Questions:
Why is my dynamically populated ACF field not translating in the other language?

January 14, 2025 at 9:04 am #16591925

Kor
Supporter

Languages: English (English )

Timezone: Asia/Singapore (GMT+08:00)

Thank you for contacting WPML support. While you are waiting for one of my colleagues to take this ticket and work on it, let me provide you with the first debugging steps and try to help with the issue quickly.

To allow us to see if any PHP errors are being produced, could you please provide us the WordPress debug.log. More Info: https://wordpress.org/support/article/debugging-in-wordpress/

To enable debug.log, open your wp-config.php file and look for:

define('WP_DEBUG', false);

And change it to:

define('WP_DEBUG', true);
// Enable Debug logging to the /wp-content/debug.log file
define('WP_DEBUG_LOG', true);
// Disable display of errors and warnings which is recommended on a live site.
define('WP_DEBUG_DISPLAY', false);
@ini_set('display_errors',0);

Then try to reproduce the issue and check if any errors were saved to the debug.log log file inside the “.../wp-content/” directory.

If you can paste your debug.log to https://pastebin.com/ and provide us with that link, it would be great!

* Please do not share the debug.log content in the reply.

January 14, 2025 at 10:46 am #16592363

sherazA-3

Hi Kor,

Here is the url - https://pastebin.com/mJ3ZnZnQ

January 14, 2025 at 9:57 pm #16595067

Andreas W.
Supporter

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

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

Hello,

Take note that there is not an error on the log that you need to worry about. This is only a Deprecated Notice which will not affect your site. Our team will solve this issue before the upcoming PHP version will be available.

About the reported issue:

It looks like your ACF Field Group is using the "Expert" settings, is this correct?

Did you set the "Select" field to "Copy"?

Take note, that if you translate the post or page with the WordPress Editor, then you can use the field group setting "Different fields across languages".

If you are using the WPML Translation Editor to create the translations, please use the field group setting "Different fields across languages".

Best regards
Andreas

January 15, 2025 at 6:34 am #16595611

sherazA-3

Hi Andreas,

I’m using the "Same fields across languages" setting in WPML for my ACF fields, not the "Expert Setting." This should copy the ACF field data across languages, correct?

However, I’m encountering an issue with a select field where the options are dynamically populated using custom code. In the primary language (English), the data is stored correctly. But when I switch to the secondary language (Arabic), the field is empty, and the data isn’t being saved.

Is there anything specific I need to adjust in my custom code to ensure the data is stored properly in the ACF field for the secondary language?

January 15, 2025 at 4:20 pm #16598340

Andreas W.
Supporter

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

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

If you use "Same fields across languages" you will need to translate the post or page together with the ACF fields on the WPML Translation Editor.

This should copy the fields.

January 16, 2025 at 5:13 am #16599665

sherazA-3

The field value is translated, but it is still not being copied to the ACF field in the secondary language. Is there anything specific I need to adjust in my custom code to ensure the value is saved in the secondary language field?

January 16, 2025 at 6:53 pm #16603624

Andreas W.
Supporter

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

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

Hi,

Please name me the name of the affected field groups and a permalink to a content on which I can see the issue.

I would like to offer to take a closer look and request temporary access (wp-admin and FTP) to the site to investigate the issue further.

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

IMPORTANT
Please be sure to back up the site and database before granting us access.

If you can't see the "wp-admin / FTP" fields, your post and site login details will be set to "PUBLIC". DO NOT publish the data unless you see the required wp-admin / FTP fields.

The private reply form looks like this:
hidden link

The next time you reply, click on "I still need assistance".

Video:
hidden link

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

Best regards
Andreas

January 17, 2025 at 5:00 pm #16607611

Andreas W.
Supporter

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

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

When creating a new product the conditional "if" fields does not allow me to make any selection. Revising ACF, I can see that there are not any Choices declared on this field.

January 17, 2025 at 6:57 pm #16608001

sherazA-3

Hi,

It will work once any of the variation attributes is assigned. The product should be a variable product.

January 17, 2025 at 7:52 pm #16608143

Andreas W.
Supporter

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

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

This does not change the fact, that on your original ACF Select Field, no Choices are set.

This means, that you are setting those values based on your custom code and this is why WPML can not translate them with the WPML Translation Editor.

The issue might be expected, as your select field has no Choices declared.

January 17, 2025 at 8:39 pm #16608187

sherazA-3

So, how do i save it in the WPML Translation because i can't add the data as static because i want to fetch the attributes.

January 17, 2025 at 9:00 pm #16608217

Andreas W.
Supporter

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

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

In this way, you might need to use WPML String Translation to register the strings and translate them.

You can do this by GetText Call in PHP or by using the following hook for this purpose:
https://wpml.org/wpml-hook/wpml_register_single_string/

Please also read this:
https://wpml.org/documentation/support/translating-the-theme-you-created/

There might not be a simple way to make sure that the field is copied, as long the field is not declared with its Choices.