This thread is resolved. Here is a description of the problem and solution.
Problem:
If you're experiencing an issue where hovering over the flag in the WPML language switcher displays HTML code instead of the expected tooltip or language name, this might be due to how the theme handles HTML in menu items.
Solution:
1. **Check Language Switcher Options**: Review your language switcher settings in WPML to ensure no HTML code is entered in fields meant for plain text. Navigate to WPML → Languages and check the 'Language switcher options' and 'Edit Languages' sections.
2. **Clear Caches**: If you're using a caching plugin or have server-side caching, clear these to ensure they're not causing the issue.
3. **Increase WP Memory Limit**: Increase your WordPress memory limit to at least 128MB by adding
define('WP_MEMORY_LIMIT', '256M');in your
wp-config.php
file.
4. **Contact Theme Developers**: The issue might stem from how your theme's menu walker handles HTML. Contact your theme developers for a fix or try modifying the
start_el()
method in your theme's menu walker file to strip HTML tags from titles.
5. **Workaround**: As a temporary solution, you can add the following code to your child theme's
functions.php
to remove the title attribute for WPML switcher items:
add_filter( 'nav_menu_link_attributes', function( $atts, $item, $args, $depth ) {<br /> if ( ! empty( $item->classes ) ) {<br /> foreach ( $item->classes as $class ) {<br /> if ( strpos( $class, 'wpml-ls' ) !== false ) {<br /> $atts['title'] = '';<br /> break;<br /> }<br /> }<br /> }<br /> return $atts;<br />}, 20, 4 );If these steps do not resolve your issue or if the solution seems outdated or irrelevant 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.
This topic contains 2 replies, has 0 voices.
Last updated by 1 month, 2 weeks ago.
Assisted by: Bobby.
