Skip Navigation

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

Problem:
The client was unable to edit or add images to translated products using Advanced Custom Fields (ACF) with WPML. The images appeared on the translated product, but the edit/remove functions were not available, and the 'add image' button did not appear.
Solution:
The issue was not related to WPML but was caused by outdated PHP code in the template that defined the ACF field group and its settings. This outdated code interfered with newer versions of ACF, preventing several UI elements from loading properly. The client resolved the problem by removing this outdated PHP code, restoring functionality to the UI elements.

If you're experiencing similar issues, we recommend checking for any outdated code or settings in your templates that might affect ACF's functionality. Additionally, ensure that your theme and other plugins are not causing conflicts. You can do this by switching to a default WordPress theme like TwentyTwenty-Four and deactivating all plugins except for WPML and ACF. If the problem persists, activate the plugins one by one to identify the culprit.

Please remember to back up your site before making any changes. If your site is live, consider performing these checks in a staging environment.

If this solution does not apply to your case, or if it seems outdated, please visit our known issues page and confirm that you have installed the latest versions of themes and plugins. If the issue persists, we highly recommend opening a new support ticket with us here.

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.

This topic contains 0 replies, has 2 voices.

Last updated by Itamar 3 weeks ago.

Assisted by: Itamar.

Author Posts
November 20, 2024 at 8:50 am #16423040

ericD-60

Background of the issue:
I am trying to use Advanced Custom Fields in combination with WPML on our website. Recently, we encountered a problem with our translated products where we can't edit or add images. The fields are set to 'copy once' since we incorporated WPML. The images on the original product still show up in the translated product after automatic translation, but the edit/remove functions are not available. All our content is contained in an ACF Flexible Content field. When we try to add a new image, the 'add image' button does not appear. 'Synchronise translations' is turned off for the product. The same problem exists on the ACF gallery fields. Link to a page where the issue can be seen: hidden link

Symptoms:
No way to interact with existing images in content. No 'add image' button when trying to add a new image.

Questions:
Why can't I edit or add images to translated products using ACF with WPML?
Why are the edit/remove functions not available for images in translated products?

November 20, 2024 at 9:14 am #16423264

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+02:00)

Hi,

If your client agrees, please give me access to your site. Otherwise, we will need to see if this problem is replicable on a fresh WordPress installation with WPML and ACF.

I'm enabling a private message for the following reply.

Privacy and Security Policy
We have strict policies regarding privacy and access to your information. Please see:
https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/
**IMPORTANT**
- - Please backup the site files and database before providing us access. --
-- If you have a staging site where the problem can be reproduced, it is better to share access to the staging site.--

Regards,
Itamar.

November 21, 2024 at 9:28 pm #16431118

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+02:00)

Hi, and thanks for the access details.

I can see the problem on the page you sent me.

hidden link

However, I can also see that WPML's Translation Editor is selected to edit this page. I'm afraid that's not right because you must use the WordPress editor in Expert mode. Please ensure to work according to our guide about the Expert mode here.

https://wpml.org/documentation/related-projects/translate-sites-built-with-acf/expert-translation-option/

If this does not help, please tell me which field group and field are in charge of this section. Also, please let me know if you will allow me to create a test product to replicate this problem.

Please note that my weekend is Friday-Saturday, and I'll be able to continue to check this issue and help you on Sunday.

Regards,
Itamar.

November 22, 2024 at 12:08 pm #16433695

ericD-60

Hi,

All the field groups are already set to expert mode, and all fields are set accordingly following this guide: https://wpml.org/documentation/related-projects/translate-sites-built-with-acf/recommended-custom-fields-translation-preferences-for-acf-and-wpml/
some time ago, and this worked fine until recently.

The "Afbeelding(image)" field is located in the following field group:

hidden link

It's in the flexible content field called "Inhoud (content)".

A little background-information about how this website is set up to work:

For products and pages we have a modular setup, starting out with the flexible content-field "tab-secties (tab sections)". Here you have the choice to pick from 2 different layouts: 1 column, or 2 columns. In this matter the client can build his/her page/product up in multiple sections, and fill each them with the desired content. In each column we use a clone field that uses the "Inhoud (content)" flexible content field as the source.

This allows us to re-use these fields in multiple locations, without having to add the same content options over and over in different fields. Also, if content options need to be added or changed, we only have to add or edit them in one field.

I hope this helps. If you need to know more let me know.

November 24, 2024 at 8:18 pm #16437586

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+02:00)

Hi,

It sounds like you have a complex ACF setting. Maybe it is something we have not tested until today, or it is a problem that has risen up and not been discovered yet. Can you help us replicate the issue on a sandbox site?

You can access it through this link:

hidden link

With this link, you'll be directly logged in.

WPML and its add-ons and ACF Pro are already installed on this site. Please configure WPML and ACF as set on your site, but only the basic configurations needed to replicate the issue.
Important! Do not import your site to the test site. We must replicate the problem on a fresh, clean WordPress installation.
Thanks,
Itamar.

November 28, 2024 at 8:17 am #16453357

ericD-60

Hello,

I tried to replicate the field configuration as close as possible on the sandbox. I made one post and a translation of it with some content. The image field in this configuaration works as expected (interact buttons are visible and can be used), but in this installation the WYSIWYG-editor seems to have a similar bug. You can't interact with the "visual" tab as can be seen here:

hidden link

When you want to edit the text you first have to switch to the "text" tab. Also any edit you make don't show up in the visual mode (stays blank). This is not normal ACF behaviour.

Could be a bug from ACF? could be a bug from ACF in combination with WPML? some field settings? I don't know.

Screenshot 2024-11-28 at 09-15-36 Edit Post “Testproduct” ‹ Sandbox — WordPress.png
November 28, 2024 at 7:51 pm #16456842

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+02:00)

Hi,

Thanks for trying to replicate the issue on the sandbox site.

However, I don't see the problem you mention with switching the WYSIWYG editor's Visual and Text options. It works for me. Please see the attached screenshot.

To continue investigating this problem on your site please proceed with the following.

We suspect a collision with the theme or another plugin might cause this problem. If possible, get your site into a minimum environment, switching to a default WordPress theme like TwentyTwenty-Four and having no plugins activated except WPML.

First, you must check if the problem persists when just the theme is switched to TwentyTwenty-Four (for example). If it persists, deactivate all plugins except WPML and its add-ons and ACF without any extensions. Then, please check if the problem persists. If it does not persist, start by activating the plugins individually and checking when the issue comes back, then report to me which plugin was the culprit.

**** Important! Please make a full site backup (files and DB) before you proceed with those steps****


*** If your site is live, you might want to try those procedures in a staging environment or a snapshot of your site on your local server or another server. ***

Regards,
Itamar.

2024-11-28_21-46-46.jpg
December 5, 2024 at 10:19 am #16480865

ericD-60

Hello,

I found the problem. It turned out it wasn't a WPML-related problem after all. Apparently the presence a piece of PHP-code in the template was the colprit. This code defined the field group in question and all settings that belonged to it. Since this code was pretty old at the time of writing, I guess it caused some sort of corruption in combination with newer versions of ACF, causing several UI-elements needed to change content to not load properly. I deleted this code, and everything works now.

Thanks for your help though, and sorry for the inconvenience.

December 5, 2024 at 12:55 pm #16481545

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+02:00)

Hey,

Thanks for updating us on what caused the problem.
We truly appreciate it!

Best Regards,
Itamar.