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)

This topic contains 6 replies, has 2 voices.

Last updated by Andreas W. 10 months ago.

Assisted by: Andreas W..

Author Posts
January 25, 2024 at 2:09 pm #15226683

Boris

user using PHP file with ACF custom fields. No ACF plugin installed (but ACF-ML is installed and active).
They want to set each field in the PHP file with the proper translation setting: for example color picker 'set to wpml_cf_perferences => 1', text field set to 'set to wpml_cf_perferences => 2' as shown in our documentation here :
https://wpml.org/documentation/related-projects/translate-sites-built-with-acf/translating-acf-blocks-with-wpml/#preparing-programatically-registered-fields-for-translation

But when you check wpml > settings > custom fields , the changes of translation settings weren't applied (no cache and no WPML cache)

January 25, 2024 at 10:27 pm #15228413

Andreas W.
Supporter

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

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

Hello,

It is sadly not possible to translate programmatically created ACF Field Groups and their Fields with WPML Advanced Custom Fields Multilingual.

The field groups need to exist on the backend, to be translatable as you need to set a translation preference for each group and also for each field if you use the "Expert" mode.

Guide:
https://wpml.org/documentation/related-projects/translate-sites-built-with-acf/

Best regards
Andreas

January 26, 2024 at 7:38 am #15228852

Boris

Hello Andreas,
I did not translate them with ACF-ML addon. I translated them exactly as WPML documented it: by adding the 'set to wpml_cf_perferences => 2' lines to each field in the PHP file.

That did not work, so I tested whether installing ACF-ML addon would help.

I need help fixing the fact that adding the wpml_cf_preferences to each field does not change the translation settings in WPML.

January 26, 2024 at 7:39 am #15228869

Boris

Also,
how would I use expert mode if I have a theme with a file with the acf fields already in there, and ACF not installed at all? I can re-install ACF, but I cannot re-import the ACF fields from the PHP file into ACF. This is not possible as far as I have been able to find.

But that should be beside the point, as WPML clearly states it is possible to set the translation settings in the PHP file itself. I need to get that working...

January 26, 2024 at 5:51 pm #15231350

Andreas W.
Supporter

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

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

Hello,

Could you please let me know where we recommend this?

"I translated them exactly as WPML documented it: by adding the 'set to wpml_cf_perferences => 2'"

"WPML clearly states it is possible to set the translation settings in the PHP file"

Please send me a link to the relative documentation.

As far as I am aware we only offer this for ACF Blocks:
https://wpml.org/documentation/related-projects/translate-sites-built-with-acf/translating-acf-blocks-with-wpml/

Best regards
Andreas

January 29, 2024 at 8:43 am #15236545

Boris

Hi Andreas,
yes. On the page you refer to, in the section:
"Making ACF Fields Registered Programmatically Translation-Ready".

This suggests that it should work.

January 30, 2024 at 2:15 pm #15244265

Andreas W.
Supporter

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

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

This documentation is related to "Translating ACF Blocks With WPML".

Are you using ACF Blocks?

The topic ‘[Closed] preparing programatically registered fields for translation’ is closed to new replies.