Home›Support›English Support›[Escalated to WPML Developers team] I notice ACF fields are not copied correctly
[Escalated to WPML Developers team] I notice ACF fields are not copied correctly
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.
Our wait time is higher than usual, please make sure you are meeting the minimum requirement - https://wpml.org/home/minimum-requirements before you report issues, and if you can take a look at current Known Issues - https://wpml.org/known-issues/. Thank you.
These underscore fields are the field key reference to each ACF field. This is how ACF knows what field the value belongs to so it knows how to handle that value. Without it, the custom ACF field does *not* work, as no value from the field can not be retrieved.
Quote from the ACF documentation:
"Each value saved in the database is given a ‘reference’ of the field’s key. This allows ACF to connect a value with its field. ACF does this so it can format values when loaded based of the field type and settings. For example, the image field contains a setting to return an array of image data instead of the attachment ID."
I initially could not retrieve ACF values from translations, so I debugged this to this exact cause, and found out this corresponding underscore field is not copied to translations, while it should from WPML settings in my initial screenshot! hidden link
I want to use and sync the original ACF value for translations, thus using "Copy" value so all my translations keep in sync with the original content.
Thank you very much. The issue is reported to the second-tier support and from the look of it it must be a bug of some sort that will go for the development team.
The fix will be available in the future releases of Advanced Custom Fields Multilingual but there is no ETA for that.
We will inform if the specific fix for this is released.
The issue is not within the additional plugin "Advanced Custom Fields Multilingual" but in WPML core itself.
In your sandbox the plugin ACF Multilingual is not even there, as it is set as a "Copy" field in the core WPML settings and does not has to be translated at all, and so this add in plugin is not needed.
I installed the ACFM plugin, set the group to 'Same fields across languages', checked if my ACF was still on 'Copy' (as well as its underscore version) in the WPML settings. But the result is the same, the underscore version of the ACF does *not* get copied to the translations rendering ACFs unfunctional on translations.
As I only use 1 ACF for this installation, I think using the ACFM plugin is overkill as copying custom term meta fields is part of WPML core and should work. I hope this will be fixed soon.
In the meantime I inserted the missing underscore versions of the ACF with an SQL update query. Maybe this is also helpful for other WPML users:
INSERT INTO wp_termmeta (term_id, meta_key, meta_value)
SELECT t.term_id, '_emnl_banner_image', 'field_65a4481d4c6c3'
FROM wp_terms AS t
INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id
INNER JOIN wp_termmeta AS tm ON t.term_id = tm.term_id
WHERE tt.taxonomy = 'category'
AND tm.meta_key = 'emnl_banner_image'
AND tm.meta_value IS NOT NULL
AND NOT EXISTS (
SELECT 1 FROM wp_termmeta tm2 WHERE tm2.term_id = t.term_id AND tm2.meta_key = '_emnl_banner_image'
);