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: Exception
This topic contains 32 replies, has 2 voices.
Last updated by johnS-9 2 months, 3 weeks ago.
Assisted by: Lauren.
Author | Posts |
---|---|
June 25, 2024 at 3:04 pm | |
johnS-9 |
Background of the issue: Symptoms: Questions: |
June 25, 2024 at 4:25 pm | |
June 25, 2024 at 4:38 pm #15823134 | |
Lauren Supporter
Languages: English (English ) Timezone: America/New_York (GMT-05:00) |
I was able to set up a test site with WPML and ACF but I am not able to reproduce the issue here. I have updated all plugins and updated to the latest WordPress version. With minimal settings (meaning only WPML and ACF plugins with a default theme), the search works in the second language. Please feel free to use this link to login to the test site and check: Since you have a staging site, I suggest disabling non WPML and ACF plugins and switch to a default theme. Update the ACF and WPML plugins and see if the issue is resolved. It could be there is something else on your site conflicting. |
June 28, 2024 at 7:14 am #15849868 | |
johnS-9 |
Thanks for the sandbox site, I've been taking a look at the settings and to replicate the issue you need to set the post types to "Translatable use translation if available or fallback to default language". I'm not getting exactly the same behaviour, on the sandbox it is possible to interact with the field, but it does still show you a message saying the field will be ignored. "Warning: ... Whatever you set in this field for a secondary language post (this post) will be ignored and values from original post will be used (if you set to copy or duplicate value for this field)." Spanish edit screen with the warning message: hidden link I've not yet been able to work out why on my site the input is disabled and the sandbox site it's not disabled. The sandbox does show what I believe to be an incorrect message to the editor. Would the disabled attribute be something WPML adds? Or do I need to look elsewhere? |
June 28, 2024 at 7:15 am #15849871 | |
johnS-9 |
I forgot to add to my last message - Despite the warning saying it will use the original value, it doesn't. It uses the translated value. I've selected some content and var_dump()'d it in single.php to compare: En: Es: Thanks, I look forward to your thoughts on this one! |
June 28, 2024 at 7:23 am #15849892 | |
johnS-9 |
Ok, I've figured out the disabled field problem, it seems to be related to the version of ACF, I've rolled the sandbox site back to ACF v6.3.0 and the field is disabled. So that should be an easy fix. hidden link. Are you able to file a bug report related to the incorrect warning? Even after I update ACF the backend is telling the editors "Whatever you set will be ignored" on the translated posts. (Which I've tested above and is not true, the translated values are used on the frontend). Many thanks, |
June 28, 2024 at 10:29 am #15851121 | |
johnS-9 |
Hi Sorry, another update... I've tried updating ACF on my site that is experiencing the disabled field issue and it is still occurring, but only for some content types. It feels like there's definitely a bug somewhere surrounding this message / functionality. Is this enough info for you to investigate? |
June 28, 2024 at 10:44 am #15851225 | |
johnS-9 |
Hi, The field disabling is coming from this file in ACFML: wp-content/plugins/acfml/assets/js/admin-script.js ```js ``` I'll stop investigating now and await your input. I believe I've taken this as far as I'm able to and that this is an ACFML bug. Many thanks |
July 3, 2024 at 7:00 am #15881047 | |
johnS-9 |
Hi, Is there any update on this? We're having this is with multiple live websites. Many thanks, |
July 4, 2024 at 3:30 pm #15893075 | |
Lauren Supporter
Languages: English (English ) Timezone: America/New_York (GMT-05:00) |
Okay I've continued testing on the sandbox site, and want to confirm that we are looking at the same thing. With the latest version fo ACF, if you set a post type to Translatabor or Fallback to Default, the search box doesn't work and the warning shows up. The warning in the sandbox site seems to be correct as it is now, because it states IF the field is set to copy or duplicate. In the case of the sandbox, the field is set to Copy Once, so it should be translatable after the first time it is updated. If you can confirm this, I'll be able to report the bug or check with developers if there is some reason that search is disabled. I appreciate your patience while I ran various tests. |
July 5, 2024 at 2:25 pm #15899012 | |
johnS-9 |
Hi Lauren, Yes your description matches what I'm experiencing. However I'm also experiencing the search field being disabled even with the latest ACF. It's disabled because of the ACFML javascript file mentioned here: All the ACFML file seems to do is disable the field! Also oddly, the sandbox site is now neither disabling the field or showing the message. Did you apply a patch? Kind regards, |
July 5, 2024 at 8:34 pm #15900164 | |
Lauren Supporter
Languages: English (English ) Timezone: America/New_York (GMT-05:00) |
I have not applied any patch,the only thing I did was update the ACF plugin. Can you send me the link and a screenshot of what you are seeing so I can compare? |
July 8, 2024 at 2:37 pm #15914080 | |
johnS-9 |
Sorry I think I was looking at the English one or something because it's disabled and showring the warning for me now. hidden link So yes, please file a big 🙂 |
July 9, 2024 at 9:02 pm #15923298 | |
Lauren Supporter
Languages: English (English ) Timezone: America/New_York (GMT-05:00) |
I have submitted this to our developers to see if the behavior is intentional and if so, to help understand the logic. If it is not intentional, it will be addressed as a bug and I will update as soon as I have more information. |
July 10, 2024 at 12:10 pm #15928023 | |
Lauren Supporter
Languages: English (English ) Timezone: America/New_York (GMT-05:00) |
On the sandbox site, the search is no longer disabled on the test page we created. The only thing I did on the test site that I can think of that may have changed, is that I set page type to Translatable Only in WPML -> Settings and then set it back to Translatable or Fallback to Default. If you test switching that on your live site, and switching it back, is the search field disabled (please make sure you have the latest version of ACF). Lastly, the message displayed is not a bug but is intentional, confirmed by the developers. The post will only be ignored if the relation field is set to Copy. In your case, it is set to translate, so it is not ignored and shows the correct translated related post. I hope that makes sense! Please let me know the results of changing the status of the page post type and if the search is working. |