Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client is setting up options pages to be translated using WPML and is experiencing issues where switching languages via the language switcher in the admin bar does not update the options page as expected. For example, changing the language to Chinese, saving the options page, and then switching back to English shows the same content as saved in Chinese. The fields in ACF are set to be translated, but they do not change language.
Solution:
We recommend the following steps to address the issue:
1. Go to WPML > Settings and scroll to the Custom Field Translation section.
2. Click on the Show system fields link.
3. Once the page is refreshed, enter the field name in the search box within the Custom Field Translation section. For example:

archive_heading_text

.
4. In the results, the field should appear twice, with one name starting with an underscore (e.g.,

_archive_heading_text

). Set the translation preference for that field to Translate.
5. Save the changes and then go to the options page and try updating the translation by switching the language.

If this solution does not resolve your issue or seems irrelevant due to updates or different configurations, 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. If the problem persists, please 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.

Tagged: ,

This topic contains 7 replies, has 2 voices.

Last updated by Prosenjit Barman 1 year ago.

Assisted by: Prosenjit Barman.

Author Posts
May 28, 2024 at 7:22 pm #15680509

Andrew Von Haden

Background of the issue:
I am setting up options pages to be translated using WPML in a site under development. I have followed the WPML guide for translating ACF options pages: https://wpml.org/documentation/related-projects/translate-sites-built-with-acf/translating-the-acf-options-page-custom-fields-with-wpml/

Symptoms:
When using the language switcher in the top admin bar, switching languages does not update the options page as expected. For example, changing the language to Chinese, saving the options page, and then switching back to English shows the same content as saved in Chinese. My guess is that the fields are never changing language. The fields in ACF are set to be translated.

Questions:
Am I missing a step in setting up the language switcher for the options pages?
Is there a specific configuration or setting required in WPML to ensure the options page content updates correctly when switching languages?

May 29, 2024 at 11:17 am #15683098

Prosenjit Barman
WPML Supporter since 03/2023

Languages: English (English )

Timezone: Asia/Dhaka (GMT+06:00)

Hello There,
Thanks for contacting WPML Support.

I understand the issue you're having. Since the translation preference for the field is set to "Translate," the field data shouldn't be synced. However, when I checked the WPML Debug info, I found that while the main ACF field is set to "Translate," the system ACF fields are set to "Copy." This discrepancy could be the reason for the issue.

Please try the following steps:

1. Go to "WPML > Settings" and scroll to the "Custom Field Translation" section.
2. Click on the "Show system fields" link.
3. Once the page is refreshed, enter the field name in the search box within the "Custom Field Translation" section. For example: `archive_heading_text`.
4. In the results, the field should appear twice, with one name starting with an underscore (e.g., `_archive_heading_text`). Make sure to set the translation preference for that field to "Translate."
5. Save the changes.
6. Then go to the options page and try updating the translation by switching the language.

Please give it a try and let me know how it goes. I will be happy to help if you need further assistance in this matter.

Best regards,
Prosenjit

May 29, 2024 at 1:42 pm #15684226

Andrew Von Haden

Neither "_archive_heading_text" or "archive_heading_text" appear in the custom field translations appear in the "Custom Fields Translation" section with Show system fields toggled on. See attached screenshots for full list of fields.

screencapture-eristag-wpengine-wp-admin-admin-php-2024-05-29-08_31_33-2.png
screencapture-eristag-wpengine-wp-admin-admin-php-2024-05-29-08_31_33.jpg
May 30, 2024 at 6:14 am #15685850

Prosenjit Barman
WPML Supporter since 03/2023

Languages: English (English )

Timezone: Asia/Dhaka (GMT+06:00)

Hi There,
Thank you for the update.

The WPML debug info of your site shows the fields, but for some reason, they are not appearing in the list. To understand the root cause, a closer inspection will be required.

I would like to request temporary access (wp-admin and FTP) to your site to take a better look at the issue. It would be better to have a testing site where the issue is replicated.

You will find the needed fields below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.

Maybe I'll need to replicate your site locally. For this, I’ll need to temporarily install a plugin called “Duplicator” or "All in One WP Migration" on your site. This will allow me to create a copy of your site and your content. Once the problem is resolved I will delete the local site. Let me know if this is ok with you.

IMPORTANT
-Please backup site files and database before providing us access.
-If you do not see the wp-admin/FTP fields this means your post & website login details will be made PUBLIC. DO NOT post your website details unless you see the required wp-admin/FTP fields. If you do not, please ask me to enable the private box. The private box looks like this:
hidden link

Looking forward to your response.

Best Regards,
Prosenjit

May 31, 2024 at 8:55 am #15691258

Prosenjit Barman
WPML Supporter since 03/2023

Languages: English (English )

Timezone: Asia/Dhaka (GMT+06:00)

Hello There,
Thank you for sharing the access information.

I have thoroughly checked and can see that the field name is not showing in the list. Additionally, changing the translation preference of the field group or the fields within it has no impact on the option page.

I have also checked the JSON file, and the configuration is correct there. Could you please share if you have taken any other approach to create the ACF fields or if the fields are synchronized in any other way?

Please also share how the Option page is created. In the ACF option page, I haven't noticed any option page created for the events post type.

This information will help further investigate and might assist in resolving the issue. Looking forward to your response.

Best regards,
Prosenjit

May 31, 2024 at 9:13 pm #15694181

Andrew Von Haden

In terms of how our ACF is set up, I am using ACF JSON sync, but that is a feature that allows you to sync files with what is on the site. It shouldn't effect the ability to make changes to the ACF fields and have it directly effect the site when you save the changes. I am also creating the options pages via the acf_add_options_page() and acf_add_options_sub_page(). For example:

// Event Options Page
acf_add_options_sub_page(array(
'page_title' => __('Event Options', 'epic'),
'menu_title' => __('Event Options', 'epic'),
'parent_slug' => 'edit.php?post_type=event',
'menu_slug' => 'event-options',
'post_id' => 'options-event'
));

These are being added in the theme in inc/acf-customizations.php.

This has my brain thinking - I wonder if it might be due to the post_id? I took a look at the Site Options page and it looks like those fields are working (they are showing correctly as locked in Chinese).

May 31, 2024 at 9:34 pm #15694208

Andrew Von Haden

Upon further digging I found this:
https://wpml.org/errata/advanced-custom-fields-acf-cant-translate-options-page-when-specifying-a-custom-post_id/

Seems like this outlines my issue, which is the post_id. Obviously I will need to work around this now, but do you have any idea why this is such an issue? I will have to rework 9 options pages and their associated fields in order to fix this.

June 3, 2024 at 4:37 am #15696120

Prosenjit Barman
WPML Supporter since 03/2023

Languages: English (English )

Timezone: Asia/Dhaka (GMT+06:00)

Hi There,
I hope you're doing well. Sorry for the delay in responding due to the weekend.

Thank you for debugging further and sharing the updates. The ACF JSON support is included in the ACFML plugin. However, you're right! The issue with the field was caused due to the post_id.

In the ACFML plugin, we have set "options" as the default variable. However, in ACF v5.2.7, the custom 'post_id' feature was introduced, but the capability to handle custom post_id has not yet been added to ACFML. Therefore, if you use a custom post ID other than the default 'options', the translation preferences for the fields within the options page will stop working.

Our dev team is already aware of the issue, and we are planning to add support in the upcoming version of the ACFML plugin. However, I don't have an ETA on when the version will be released. For now, you can follow the workaround mentioned in this Errata.

I'm also adding this issue to our development ticket to increase its priority. If there are any updates, I will surely inform you.

Best regards,
Prosenjit

June 3, 2024 at 2:34 pm #15698201

Andrew Von Haden

Awesome, thank you for your help!