[Resolved] Dynamically populated acf field not translating
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.
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?
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 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.
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".
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?
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?
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.
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.