[Resolved] The menu is displayed in the form of html code
This thread is resolved. Here is a description of the problem and solution.
Problem:
Client is trying to add a language switcher to their website's menu but ends up with a lot of code displayed instead of the flag image and language name.
Solution:
If you're experiencing an issue where your language switcher displays code instead of the correct flag and language name, it might be due to a custom navigation menu implementation from your theme. We recommend you follow these steps:
1. Make sure to back up your entire website.
2. Navigate to Appearance > Theme File Editor and select the
inc\wp_bootstrap_navwalker.php
file.
3. Find line 250 and replace it with the following code:
4. Save the changes and check if the issue is resolved.
Please note that this solution might be outdated or not applicable to your case. If the issue persists, we highly recommend checking related known issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If you still need assistance, please do not hesitate to open a new support ticket in the WPML support forum.
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.
Tell us what you are trying to do?
Add a language switcher on the clients website. I wanted to add a menu language switcher and chose ‘Menu PL’ as a position and what I’m ending with is a menu which works properly but there’s a lot of code instead of an image of a flag and language name.
Is there any documentation that you are following?
-
Is there a similar example that we can see?
screenshot (I'm using default settings when I'm adding this menu (WPML\Languages\Menu language switcher)).
What is the link to your site? hidden link - I can share login/pass in a more safe way than pasting it here.
Can you verify where's the problem? Is it custom menu which client created (if yes how can we correct it?).
Thank you for contacting WPML Support, I will be happy to help you.
1) It seems this might be a theme issue. WPML Language switcher takes formatting from the current theme to make the language switcher style consistent to the current theme menu.
- Could you try to disable flag images and see if the language text shows correctly?
You may disable it from WPML >> Languages > Menu language switcher and click on the pen icon to edit the language switcher and uncheck the “Flag” checkbox and press the “Save” button.
2) Would it be possible to check if the issue happens if you switch to a default WP theme?
After, check if the issue is still happening.
Note: Please make sure you have a full backup (files & database) before trying anything on your website.
Hello Lucas,
1) I've disabled the flag (screen "custom_theme.png") - there's just less code
2) changing the default theme didn't help (checked all themes [2022/2023/2024]) - screenshot2.
Backup created.
I can share credentials if that helps.
I would like to request temporary access (wp-admin and FTP) to your site to take a better look at the issue. It would be better to a testing site where the issue is replicated.
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.
Maybe I'll need to replicate your site locally. For this, I’ll need to temporarily install a plugin called “Duplicator” or "All in One WP Migration" on your site. This will allow me to create a copy of your site and your content. Once the problem is resolved I will delete the local site. Let me know if this is ok with you.
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:
Regarding the Language Switcher in the Menu, I could indeed reproduce the issue locally, in a copy of your website (I had to install All In One WP Migration, as Duplicator did not work). Even deactivating all plugins and changing themes didn't solve the issue.
I sent your ticket to our development team, which will take a deeper look at your code, to find a cause and a solution. That can take a few days, thank you for your patience. As soon as I have feedback from them, I'll let you know.
I got feedback from our developers. It appears that the issue was being caused by a custom navigation menu implementation from your theme. Please try these steps and let me know how it goes:
1. Make a full backup of your website;
2. Go to Appearance > Theme File Editor and select the inc\wp_bootstrap_navwalker.php file;
3. Replace line 250 with the following line: