Skip Navigation

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

Problem:
If you're experiencing an issue where the search input field on an ACF relationship field is disabled in translated posts, this might be due to a change introduced in version 2.1.0 of the Advanced Custom Fields Multilingual (ACFML) plugin. This problem persists in version 2.1.3.
Solution:
We recommend modifying a line of code in the ACFML plugin. In the file

acfml/classes/class-wpml-acf-relationship-field.php

, change line 14 from:

$has_element_with_display_translated = true;

to:

$has_element_with_display_translated = false;

This change might resolve the issue. However, please note that this solution could become outdated or might not apply to your specific case. 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.

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 32 replies, has 2 voices.

Last updated by johnS-9 2 months ago.

Assisted by: Lauren.

Author Posts
July 10, 2024 at 1:41 pm #15928338

johnS-9

Hi Lauren,

On the sandbox site the search is still disabling for me even with a clear browser cache. Screenshot attached.

I'm viewing this URL:
hidden link

Kind regards,

SCR-20240710-narm.png
July 16, 2024 at 2:53 pm #15961253

Lauren
Supporter

Languages: English (English )

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

After clearing the cache I can use the search field in the second language here:
hidden link

Ify you still cannot, could you please capture a screencast so I can make sure I'm following your exact steps?

July 17, 2024 at 8:05 am #15964613

johnS-9

Hi Lauren,

Thanks for checking. At this point I don't know how to get the problem to consistently occur. It keeps flip-flopping between disabled and not disabled for reasons I can't work out. Which isn't really a conclusion either way (and not something I can say to the client).

Looking at the code, specifically in this case of the relationship field this is the line of JS in ACFML that is disabling the relationship field's search box.

```
$('.wpml_acf_annotation.relationship').prev().find('input').prop('disabled', true);
```

The JS file inside ACFML (Screenshot ihvf) would be disabling relationship fields (plus some others) when it triggers.

And the JS file is always enqueued inside ACFML's init function (Screenshot iivp).

The issue is still happening for me (Screenshot ilfc).

Kind regards,

SCR-20240717-ilfc.png
SCR-20240717-iivp.png
SCR-20240717-ihvf.png
July 17, 2024 at 8:21 am #15964710

johnS-9

I've tried to take this as far as I can on the test site, I've recreated the custom post types, made the WPML translation settings for those match my site and made the Related Content relationship field match. (Screenshot iord)

My site - Still disabled
Test site - Not disabled.

All I can see at this stage is that my site is loading the acfml/assets/js/admin-script.js file, which is disabling the fields, and the test site is not loading the acfml JS file. (Screenshot iqjz)

I really need to know why it would not load? Is another field on my site maybe causing the JS file to enqueue / no be dequeued?

Many thanks,

SCR-20240717-iqjz.png
SCR-20240717-iord.png
July 17, 2024 at 6:27 pm #15967888

Lauren
Supporter

Languages: English (English )

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

Do you have the latest version of ACF on your site? Also, we will need to test your site in minimal settings, meaning only WPML active with ACF plugins and a default theme. Do you have a staging site where we can test that? If not, you can set one up with a plugin like WP Staging, or if that won't work, let me know and we can migrate a copy of your site to our cloudways server for testing in minimal settings.

July 18, 2024 at 12:03 pm #15972338

johnS-9

Hi Lauren,

I've created a copy of the site on our Cloudways server and disabled all but 5 essential plugins (ACF, WPML, etc) but the problem still persists.

Can you send me a private form so I can share access? What would you need? CMS access? FTP access?

Many thanks,

July 18, 2024 at 12:19 pm #15972435

Lauren
Supporter

Languages: English (English )

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

I would like to request temporary access (wp-admin and FTP) to your site to take better look at the issue. You will find the needed fields for this 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.

Our Debugging Procedures

I will be checking various settings in the backend to see if the issue can be resolved. Although I won't be making changes that affect the live site, it is still good practice to backup the site before providing us access. In the event that we do need to debug the site further, I will duplicate the site and work in a separate, local development environment to avoid affecting the live site.

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 make a backup of 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

July 18, 2024 at 12:27 pm
July 22, 2024 at 2:55 pm #15987585

Lauren
Supporter

Languages: English (English )

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

I noticed on the two links you shared that are disabled, that these publications are not linked to an English translation. If you link it to an English translation, does the search work after that? I'm trying to determine if that could be the difference between the ones that are working and the ones that are not.

July 22, 2024 at 3:05 pm #15987620

johnS-9

Hi Lauren,

Interesting idea! Testing the theory out:

Loaded this non-English item, fields are disabled.
hidden link

I created this English item:
hidden link

Went back to the French item, connected it with the English item.
And now the fields **are** searchable here:
hidden link

---

I've just been going through the admin listing, editing items that have a translation a lot of them are not disabled.

I came across this one which is still disabled:
hidden link

---

Another one:
hidden link

And without update_needed in the URL, same effect:
hidden link

---

I started to think maybe "Update needed" meant it was disabled, but then this one doesn't fit that theory either.

hidden link

---

I don't think we've pinpointed the pattern just yet... Is this at a stage it can be escalated to the dev team yet? I'll be on leave next week so can't follow this up much during that time.

Kind regards,

July 24, 2024 at 12:51 pm #15998477

Lauren
Supporter

Languages: English (English )

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

I have escalated this to our 2nd tier team so that they can further debug. I hope to have some additional information by the time you return. I hope you enjoy your time away!

August 12, 2024 at 12:34 pm #16062175

johnS-9

Hi Lauren,

Just checking in to see if you had any news?

Many thanks

August 12, 2024 at 2:08 pm #16062624

Lauren
Supporter

Languages: English (English )

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

Our second tier team is looking into this and will hopefully have an update for me soon. I'll reply here as soon as I have more information.

August 28, 2024 at 1:36 am #16112349

Lauren
Supporter

Languages: English (English )

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

Our developers have found that in a local copy of the sandbox site, with all plugins updated to their recent releases (ACF and WPML), they are no longer able to reproduce the issue. Can you please test that on your live or staging site and let me know if you see the issue still happening?

August 28, 2024 at 7:05 am #16112784

johnS-9

Hi Lauren,

Thanks for the update. I see the sandbox link you provided has been deleted so I'm not able to check that. "Your sandbox has expired".

I've updated all of the active plugins on the test site I shared with you and I'm still having the issue. (Screenshot attached of active plugins).

I'm still seeing the issue here:
hidden link
(Screenshot attached).

And I'm still seeing the problem Javascript loading which is just some jQuery setting .prop('disabled', true) on the elements I'm having issues with.
(Screenshot attached).

(The login details for wpml.calp.sbx.so that I shared previously are still valid).

Could you ask the developers to take another look please?

Thanks,

SCR-20240828-hphw.png
SCR-20240828-hpoq.png
SCR-20240828-hogy.png