Home›Support›English Support›[Resolved] Programatically set wpml_synchronise_acf_fields_translations for ALL posts and pages
[Resolved] Programatically set wpml_synchronise_acf_fields_translations for ALL posts and pages
This thread is resolved. Here is a description of the problem and solution.
Problem: The client needs to programmatically set
wpml_synchronise_acf_fields_translations
to false for all existing and new posts and pages to prevent content on translated pages from being overwritten when the default language page is updated. Solution: We recommend overriding the default value of
ACFML_REPEATER_SYNC_DEFAULT
in your theme’s functions.php file by adding the following code:
If this solution does not apply to your case, or if it seems outdated, we 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. Should you need further assistance, please do not hesitate to open a new support ticket at 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:
We would like to programmatically set wpml_synchronise_acf_fields_translations to false for all existing and new posts and pages on the site hidden link. This is to prevent the content on translated pages from being overwritten when the page in the default language is updated. We are experienced developers and are comfortable adding custom code.
Symptoms:
When wpml_synchronise_acf_fields_translations is set, updating the page in the default language causes the content on translated pages to be overwritten.
Questions:
Is there a hook we can use to ensure that wpml_synchronise_acf_fields_translations is always set to false, preventing default language content from syncing to translated pages?
"Do I understand correctly that your translated content is getting overwritten with original content if you edit and save the original content?"
Yes that is correct and we will try updating the plugin.
However we would still like to programmatically set wpml_synchronise_acf_fields_translations to false for all existing and new posts and pages on the site.
These hooks will only fire if the field(s) are set to "Copy".
I can sadly not suggest any further hooks, as I can not guarantee if changing them could cause any unexpected side-effects or harm your site.
Further, our support is not responsible for providing custom code solutions, but you can try to reach out to a contractor who might be able to assist you with this matter.
In case there is any confusion, we are NOT looking to sync our custom fields from default language to translations.
We are looking to set the value of a WPML field that appears on default language posts and pages (see screenshot): wpml_synchronise_acf_fields_translations
Rather than have this controlled by the checkbox in the UI, we'd like to programmatically set it to false for all posts and pages.