Skip Navigation

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

Problem:
After syncing menus using WP Menu Sync, visiting pages in secondary languages leads to a critical error. This issue is temporarily resolved by deleting the menu translations, which persist on the Front End despite deletion.
Solution:
Set the URL field in menu items to "Don't translate" as WPML automatically handles URL translation for menu items. If you need a URL field for other purposes, create a separate one with a different name to avoid conflicts. Additionally, remove the value

a:1:{i:0;s:0:"";}

from your theme's code, as it should be a string but is incorrectly formatted as a blank array, causing errors.
Ensure that you fully translate the menu and verify its behavior on the Front End. If problems persist, we 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 issue still occurs, 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 11 replies, has 2 voices.

Last updated by Lucas Vidal de Andrade 3 months, 1 week ago.

Assisted by: Lucas Vidal de Andrade.

Author Posts
June 14, 2024 at 1:08 pm

Steven Jackson

After Syncing menus via WP Menu Sync, visiting secondary languages leads to a critical error (this information has not been fully verified by support).

Deleting the menu translations solves the issue, as translations persist on the Front End.

June 14, 2024 at 2:44 pm
June 14, 2024 at 7:29 pm #15741187

Lucas Vidal de Andrade
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hey there,

I'm still checking your issue, and haven't found a cause to the behavior you are experiencing yet. I'll get a second opinion with my colleagues and create a local copy to better search for a solution.

Please confirm, if after deleting the translations, the front end menus were behaving as expected.

I'll get back to you as soon as I have new information. Thank you for your patience.

June 17, 2024 at 7:38 am #15743598

Steven Jackson

Hi Lucas

Thanks for the update. As discussed yes the critical error is gone when the translated menus are deleted and they appear ok except for logged in admins. But the custom links are not translated anymore.

June 17, 2024 at 6:30 pm #15746724

Lucas Vidal de Andrade
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hey there,

I sent your ticket to our developers, so they can take a more in-depth look into your issue. They usually take a few days to do that, so I'll update you as soon as have new information from them. Thank you for your patience.

June 24, 2024 at 9:48 am #15805138

Steven Jackson

Hi Lucas

Just to confirm the menu thumbnails are not displaying correctly as you thought they was, maybe it was caching your side but in all other languages it is just showing the place holder images instead, see screenshot.

Screenshot 2024-06-24 104537.jpg
June 24, 2024 at 1:29 pm #15807641

Lucas Vidal de Andrade
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hey there, thank you for sharing. I'm trying to speed things up with our devs, so we can get to a solution quickly.

Just a side note, custom code is outside the scope of this Forum. We'll check if it's an issue from WPML, but it might be possible that the issue is related to the implementation of your custom header element. Let's wait and see what we find out.

June 28, 2024 at 1:37 pm #15852336

Steven Jackson

Hi

I have had a quick look at this on a new dev site I created and it appears to be to do with the custom link menu items which in our case just has a "#" value. Upon checking with Caching and Redis off I still had the issue.

I noticed it had got so most of the way through the menu when re-launching the menu sync.

So I checked the menu and in the other languages and see that in the Pre Sales Menu item the value is "Array" (see screenshot).

In menu sync you can see there is loads which are trying to rename label to the Dutch versions of Pre-Sales. Buying and After Sales. The only thing I can think of is I recently discovered and tried using the option from menu sync "Untranslated string Achat The selected strings can now be translated using the screen " to set the translated labels for these as I normally do manually and I wonder if the string translation part is what has broken it.

Anyway removing these 3 custom links from the translated menu resolves the issue in that language but changing the URL "Array" > "#" does not.

I have removed the main menu strings translations, deleted the menu and re-synced but the issue persits. Syncing the menu excluding Pre-Sales. Buying and After Sales doesnt break the site but the menu is not formed correctly. But confirms it is these 3 menu items which are the issue.

Hopefully this helps you in your investigations.

Screenshot 2024-06-28 at 14-29-44 WP Menus Sync ‹ Airquee — WordPress.png
Screenshot 2024-06-28 at 14-21-24 String Translation ‹ Airquee Inflatables — WordPress.png
Screenshot 2024-06-28 at 14-16-36 WP Menus Sync ‹ Airquee — WordPress.png
Screenshot 2024-06-28 at 14-11-57 Menus ‹ Airquee — WordPress.png
Screenshot 2024-06-28 at 14-12-12 WP Menus Sync ‹ Airquee — WordPress.png
June 28, 2024 at 4:45 pm #15853422

Lucas Vidal de Andrade
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hey there,

Thank you for sharing all the details. I got feedback from oure developers. Please make sure to make a full website backup and follow these steps:

1. Go to WPML > Settings > Custom Fields Translation and set "url" as Don't Translate (check image 01);
2. Install the Adminer plugin or access your database in other prefered way;
3. In the wp_postmeta table, delete all url entries, where the value is "a:1:{i:0;s:0:"";}" (check image 02). Please only delete the fields that have that specific value;

After that, your website must be up and running as expected. I tested the solution in the staging version you sent us. Please let me know how it goes.

01.jpeg
02.jpeg
July 1, 2024 at 9:00 am #15866968

Steven Jackson

Hi Lucas

Thank you for this. I am just testing this on a dev site. It appears to work but I need to test to make sure nothing else is broken. To help me better understand what I need to check. Can you please confirm why we have set URL to not be translated it was set to copy. I did not set these settings it was the original developer or the WPML defaults. Will this affect future URLs being translated in other languages as we have an intermittent issue with this especially in ACF Blocks already.

Also what does the value "a:1:{i:0;s:0:"";}" mean and removing achieve?

Also why has this just started in past couple of weeks since a recent update I would say or is it where I tried to set the menu strings ? "Untranslated string Klantenservice The selected strings can now be translated using the screen " via the WP Menu Sync?

I still can see lots of "Rename label to Achat" etc for all the languages see screenshot.

Screenshot 2024-07-01 a[...].png
July 1, 2024 at 12:27 pm #15868502

Lucas Vidal de Andrade
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hey there,

The URL field must be set to "Don't translate" because we already have a logic that does that automatically for menu items. I recommend you create a separate URL field (with another name) if you wish to use it somewhere else. This way, we don't have conflicts with the two instances.

Regarding the value a:1:{i:0;s:0:"";} that needs to be removed, it's because the expected value is a string, and probably because of your theme, it's receiving a blank array:

[25-Jun-2024 12:33:45 UTC] PHP Fatal error:  Uncaught TypeError: strpos(): Argument #1 ($haystack) must be of type string, array given in C:\laragon\www\lite\wp-includes\nav-menu-template.php:481
Stack trace:
#0 C:\laragon\www\lite\wp-includes\nav-menu-template.php(481): strpos(Array, '#')
#1 C:\laragon\www\lite\wp-includes\nav-menu-template.php(196): _wp_menu_item_classes_by_context(Array)
#2 C:\laragon\www\lite\wp-content\themes\AQ-Storeront-Child-ESI\header.php(78): wp_nav_menu(Object(stdClass))
#3 C:\laragon\www\lite\wp-includes\template.php(810): require_once('C:\\laragon\\www\\...')
#4 C:\laragon\www\lite\wp-includes\template.php(745): load_template('C:\\laragon\\www\\...', true, Array)
#5 C:\laragon\www\lite\wp-includes\general-template.php(48): locate_template(Array, true, true, Array)
#6 C:\laragon\www\lite\wp-content\themes\AQ-Storeront-Child-ESI\page.php(9): get_header()
#7 C:\laragon\www\lite\wp-includes\template-loader.php(106): include('C:\\laragon\\www\\...')
#8 C:\laragon\www\lite\wp-blog-header.php(19): require_once('C:\\laragon\\www\\...')
#9 C:\laragon\www\lite\index.php(17): require('C:\\laragon\\www\\...')
#10 {main}
  thrown in C:\laragon\www\lite\wp-includes\nav-menu-template.php on line 481
[25-Jun-2024 12:34:25 UTC] PHP Fatal error:  Uncaught TypeError: strpos(): Argument #1 (

As for your last question, it's difficult to tell. Please fully translate the menu and check if it works as expected. It's best to check the expected behavior in the Front End. Let me know.

July 1, 2024 at 12:48 pm #15868632

Steven Jackson

Hi Lucas

The fix has tested ok on the live site.

Hopefully the issue is now resolved and will not re-occour. As I said it only started a few weeks ago.

Regards

Steve

July 1, 2024 at 1:01 pm #15868718

Lucas Vidal de Andrade
Supporter

Languages: English (English ) Spanish (Español ) German (Deutsch ) Portuguese (Brazil) (Português )

Timezone: America/Sao_Paulo (GMT-03:00)

Hi Steve,

That's good to hear. Please be aware that your theme might recreate the empty array values. If you notice weird behaviors again with your theme, you can check and the delete the improper values for the url field in postmeta, as already instructed.

You can reach out to us via chat, in case you have future questions 🙂

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.