Skip Navigation

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

Problem:
The client is experiencing a JavaScript error 'TypeError: Cannot read properties of undefined (reading 'indexOf')' while editing a custom field in their WordPress site using WPML and ACF.
Solution:
1. We recommend confirming if the issue persists when only WPML plugins and ACF are active, with all other plugins and custom code disabled.
2. If the problem continues, provide a staging site for further investigation. Ensure to back up your site before making any changes.
3. Consider checking if the issue might be related to the browser, device, user, or location used for accessing the site.
4. Ensure that ACF field groups translation settings are set as not translatable to avoid issues. More details can be found here: Advanced Custom Fields field group should be set as not translatable.

If this solution does not resolve your issue or seems irrelevant due to being outdated or not applicable to your 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. For further assistance, 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 9 replies, has 1 voice.

Last updated by Dražen Duvnjak 1 week ago.

Assisted by: Dražen Duvnjak.

Author Posts
November 17, 2024 at 11:48 am #16411652

ahmedD

Background of the issue:
i have a problem while editing an custom filed TypeError: Cannot read properties of undefined (reading 'indexOf') at s (hidden link) at hidden link at Array.sort () at hidden link at hidden link at Object.Wt [as useMemo] (hidden link) at e.useMemo (hidden link) at Jd (hidden link) at ht (hidden link) at vr (hidden link)

Symptoms:

Questions:
i have a problem while editing an custom filed TypeError: Cannot read properties of undefined (reading 'indexOf') at s (hidden link) at hidden link at Array.sort () at hidden link at hidden link at Object.Wt [as useMemo] (hidden link) at e.useMemo (hidden link) at Jd (hidden link) at ht (hidden link) at vr (hidden link)

November 18, 2024 at 8:27 pm #16416507

Andrey
Supporter

Languages: English (English ) Russian (Русский )

Timezone: Europe/Kyiv (GMT+02:00)

While one of my teammates takes care of your ticket, I will provide you with the first debugging steps.

Are you using the latest version of WPML (4.6.14), and have all related plugins been updated on your installation?

Additionally, please upload any relevant screenshots or links that can help illustrate the problem. I want to ensure that we fully understand the issue so we can provide the best possible solution.

I have enabled debug information for this support ticket. Please refer to this link for instructions on how to retrieve this information from your site and provide it to us: http://wpml.org/faq/provide-debug-information-faster-support/

November 18, 2024 at 8:34 pm #16416516

ahmedD

here is the video explaining the problem
hidden link

November 19, 2024 at 8:58 am #16418150

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

thanks for coming back.

1) Try to create a new page and re-translate and see if this issue still happens.

2) Try to create a similar page in AR directly and check if the issue still happens.

3) How are you creating and adding custom fields to this page, via ACF or?

Let me know.

Regards,
Drazen

November 19, 2024 at 9:07 am #16418212

ahmedD

1) Try to create a new page and re-translate and see if this issue still happens.

i made a one university in english then tried to translate to arabic but same problem happened

The editor has encountered an unexpected error.

2) Try to create a similar page in AR directly and check if the issue still happens.

i tried , just after i click add button same problem

3) How are you creating and adding custom fields to this page, via ACF or?

yes im using acf

November 19, 2024 at 9:07 am #16418213

ahmedD

if you want i can share my username and password so you can check by your self

November 19, 2024 at 9:14 am #16418324

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

great, thanks for getting back.

Since the issue happens also when creating a page in Arabic, please try next: Disable WPML plugins, and from WP settings change the language to Arabic. Create a new page and check fi the issue still happens.

It could be the issue is not related to WPML; but to AR language and ACF.

Let me know how it goes.

Regards,
Drazen

November 19, 2024 at 11:59 am #16419341

ahmedD

Hello , i tried to do that but its still same problem please check the video

hidden link

i believe the problem is related with the configuration between ACF and WPML because other ACF post types doesn't have this problem , for example i have other ACF post type called Majors is working fine , but when its come to universities there's something wrong with WPML configuration

November 19, 2024 at 12:36 pm #16419517

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

thanks for getting back and sharing the video, as I might have a clue why it happens.

The error that you got that happens sometimes, is probably related to your server and resources of hosting. I advise you to check it out / logs and increase it since a similar issue was reported and resolved in that way.

- https://wpml.org/forums/topic/https-wpml-org-forums-topic-woo-paymetns-admin-not-working-when-wpml-is-on/page/3/#post-16304131

Regards,
Drazen

November 19, 2024 at 1:10 pm #16419791

ahmedD

Dear Drazen , i think you didnt watch the video until the end

there's any problem in the server my mean problem is when im trying to edit a university post im getting this error

"The editor has encountered an unexpected error."

please dont care about the other error which appeared in the video its something diffrent related with my browser

November 19, 2024 at 1:33 pm #16419924

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

I have watched the video, but looked to me like related error.

1) Can you confirm issue still happens when using only WPML plugins and ACF, all other plugins and custom code disabled.

2) If the issue still happens after step 1, please if possible provide a staging site, so I can disable plugins, check error logs and etc to see what is wrong.

Please make sure to create a backup, before doing any actions, just in case.

Regards,
Drazen

November 20, 2024 at 7:51 am #16422585

Dražen Duvnjak
Supporter

Languages: English (English )

Timezone: Europe/Zagreb (GMT+01:00)

Hello,

thanks for getting back.

I have checked, but the issue does not happen on my side, it works just fine. Video: hidden link

It could be maybe related to your browser issue, as you mentioned before, or user. I suggest trying in different devices, users, location and etc.

Also please note you should not change ACF field groups translation settings, as it can cause issues, it should be not translatable:

- https://wpml.org/errata/advanced-custom-fields-field-group-should-be-set-as-not-translatable/

If you need further help with this, please open a new ticket / chat and we will be glad to advise further.

Regards,
Drazen