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.

Tagged: 

This topic contains 1 reply, has 0 voices.

Last updated by Andreas W. 1 week, 6 days ago.

Assisted by: Andreas W..

Author Posts
May 1, 2025 at 12:28 pm #16986517

michelleM-18

Background of the issue:
I am trying to have fields hidden in the WPML translation editor by setting them to copy or copy_once. This is currently not working, additionally we had modified one of the files in acfml in a previous ticket (which i cannot find!). It appeared that this at the initial time of testing locally was fixed. Revisiting 2 weeks later only to find that certain fields had re-appeared unknowningly. This was not caused by an acfml plugin update and the bug is still occuring on all environments we test on.

In previous guidance we established that using 'wpml_cf_preferences' => # was a way to set fields to translate, copy, copy_once or nothing. This is fully implemented, but doesn't appear to be working.

The Setup: We use ACF and use PHP to define our fields. Our ACF fields appear in Blocks (Gutenberg Blocks) in our website.
The Problem: Our site requires the translation editor to hide certain fields such as dropdowns. This behaviour is intermittent, working on some fields, but not others - almost randomly. The issue is happening around most fields, including dropdowns and link fields.

I want to give an example of defining wpml_cf_preferences to a dropdown. Many of these links and dropdowns are additionally shown in repeater fields.

Parent Repeater:
'label' => $this->label,
'name' => $this->name,
'type' => 'repeater',
'layout' => 'block',
'button_label' => 'Add Button',
'sub_fields' => [],
'wpml_cf_preferences' => 3,

Example of a Repeater Sub Field:
[
'key' => 'button_type',
'name' => 'Button Type',
'type' => 'select',
'required' => true,
'wrapper' => ['width' => '50',],
'return_format' => 'array',
'wpml_cf_preferences' => 1,
],

Symptoms:
Fields set with 'wpml_cf_preferences' => 1 or 3 are showing in the translation editor intermittently, more often than not. Fields with 'type' => 'link', 'wpml_cf_preferences' => 2 show the URL in the translation editor instead of just the title.

You may notice in the upload, that the following fields are showing:

'h1', '#what-we-do', 'dark', 'outlined' - these have all been set to 'wpml_cf_preferences' => 1. Additionally where links are shown we (sometimes) get the full URL appear in the block editor, regardless of 'wpml_cf_preferences' => 2 being set.

Questions:
Why are fields with 'wpml_cf_preferences' => 1 or 3 not consistently hidden in the translation editor?
Why do fields with 'type' => 'link', 'wpml_cf_preferences' => 2 show the URL in the translation editor?

May 3, 2025 at 5:09 am #16991362

Andreas W.
WPML Supporter since 12/2018

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

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

Hello,

This seems to be related to the following known issue which will be solved in the upcoming version of "Advanced Custom Fields Multilingual" 2.2.0.

Source:
https://wpml.org/errata/advanced-custom-fields-local-fields-translation-preference-issue-for-php-registered-system-fields/

The only workaround would be at the moment to make sure that the fields are registered inside ACF on your wp-admin backend.

Best regards
Andreas