Troubleshooting Common Polylang Language Switcher Issues
Content
Adding a language switcher to your WordPress site with the Polylang plugin is a common requirement, but it can sometimes lead to unexpected behavior. Based on community reports, here are the most frequent issues and how to resolve them.
1. The Dropdown Doesn't Work
A common problem is when the language switcher is added via PHP code (e.g., using pll_the_languages()) or as a widget, but the dropdown functionality fails to activate. This is often not a bug in Polylang but a conflict with your theme's styles or scripts.
Why it happens: Your theme's CSS might be overriding the necessary styles for the dropdown, or its JavaScript could be interfering with the switcher's interactivity.
How to fix it:
- Check for JavaScript errors: Open your browser's developer console (F12) and see if any red error messages appear when you click the switcher. Errors here often point to a conflict with another script, like a jQuery library from your theme or another plugin.
- Inspect the CSS: Use your browser's inspector tool to check if the dropdown
<ul>element is being generated but is hidden due to adisplay: none;oroverflow: hidden;rule from your theme. - Use the official widget: If you are coding it manually, try using the built-in Language Switcher widget instead, as it includes baseline styles and scripts for the dropdown.
2. The Switcher Overlaps Other Elements
Another frequent issue is the dropdown list overlapping with your site's menu or header, making it difficult to use.
Why it happens: This is almost always a styling issue related to CSS z-index and positioning. The theme controls the layout, and the switcher may not have a high enough z-index value to appear above other elements.
How to fix it:
- Add custom CSS to increase the switcher's
z-indexand ensure it has apositionvalue ofrelativeorabsolute. For example:.pll-switcher { position: relative; z-index: 9999; } - Use your browser's inspector to identify the specific CSS classes applied to your switcher and adjust the positioning rules accordingly.
3. The Switcher Is Not Available in Menus or the Site Editor
Many users report they cannot find the option to add the language switcher to their navigation menu, especially in block-based themes like Twenty Twenty-Four that use the full Site Editor.
Why it happens: In the classic WordPress Customizer (Appearance > Menus), you must first enable the switcher in your screen options. In the new Site Editor, native support for the Polylang switcher may be limited as it relies on block functionality.
How to fix it:
- Classic Menus: Go to Appearance > Menus. Click Screen Options at the top right and check the box for Language Switcher. It should then appear in the left-hand column for you to add to your menu.
- Site Editor (Block Themes): The Polylang team suggests using a custom HTML block or a shortcode block to insert the switcher if a dedicated block is not available. You can use the provided PHP function or shortcode in these blocks.
4. Customizing the Look and Feel (CSS)
Users often want to change flags to classes, arrange items horizontally, add borders, or change colors.
Why it happens: Polylang outputs minimal inline styles to function. All advanced styling is intended to be handled by your theme's CSS or your own customizations.
How to fix it:
- Horizontal List: To display flags or languages inline, target the list items with CSS:
.pll-switcher li { display: inline-block; margin-right: 10px; } - Replace Inline Flag Styles: To change the default inline styles on flags, you can use the
pll_get_flagfilter to modify the HTML output, replacing thestyleattribute with a CSS class. - Colors and Borders: Use your browser's inspector to find the correct CSS classes for your switcher's elements (e.g., links, dropdown background) and override them with your own rules in the Additional CSS section of your theme.
Need More Help?
Since front-end display and styling are primarily controlled by your WordPress theme, many layout issues are best diagnosed by checking your theme's documentation or seeking help from its support channels. For complex issues, enabling debug mode in WordPress can help identify underlying PHP errors.
Related Support Threads Support
-
Dropdown does not work on my endhttps://wordpress.org/support/topic/dropdown-does-not-work-on-my-end/
-
language switcher in headerhttps://wordpress.org/support/topic/language-switcher-in-header-3/
-
language switcher problemhttps://wordpress.org/support/topic/language-switcher-problem-6/
-
Show Border Around Language Switcher Nameshttps://wordpress.org/support/topic/show-border-around-language-switcher-names/
-
About Language Switcher adding into custom layouthttps://wordpress.org/support/topic/about-language-switcher-adding-into-custom-layout/
-
language switcher in menu creating style for width and heighthttps://wordpress.org/support/topic/language-switcher-in-menu-creating-style-for-width-and-height/
-
In Responsive menu LANGUAGE SELECTOR overlaps the headerhttps://wordpress.org/support/topic/in-responsive-menu-language-selector-overlaps-the-header/
-
Widget doesn’t work on custom themehttps://wordpress.org/support/topic/widget-doesnt-work-on-custom-theme/
-
Switch buttonhttps://wordpress.org/support/topic/switch-button/
-
widget language switcher stops working sometimeshttps://wordpress.org/support/topic/widget-language-switcher-stops-working-sometimes/
-
Language Switcher on Twenty Twenty Fourhttps://wordpress.org/support/topic/language-switcher-on-twenty-twenty-four/
-
Language switcher errorhttps://wordpress.org/support/topic/language-switcher-error/
-
How to change language switcher background color?https://wordpress.org/support/topic/how-to-change-language-switcher-background-color/
-
Inserting a language switch button in each post publishedhttps://wordpress.org/support/topic/inserting-a-language-switch-button-in-each-post-published/
-
Ineed To Add Language Switcher in Headerhttps://wordpress.org/support/topic/ineed-to-add-language-switcher-in-header/
-
Twenty twentyfour: NOT able to get language switcher on menuhttps://wordpress.org/support/topic/twenty-twentyfour-not-able-to-get-language-switcher-on-menu/
-
Accessibilty issue with language switcherhttps://wordpress.org/support/topic/accessibilty-issue-with-language-switcher/
-
Language switcher, Displays as a dropdown, doesn’t work in footerhttps://wordpress.org/support/topic/language-switcher-displays-as-a-dropdown-doesnt-work-in-footer/
-
Language switcher dropdown adds “#pll_switcher”https://wordpress.org/support/topic/language-switcher-dropdown-adds-pll_switcher/
-
Language Switcher Option does not appear on Appereance > Menuhttps://wordpress.org/support/topic/language-switcher-option-does-not-appear-on-appereance-menu/
-
Language switcher in widget, horizontalhttps://wordpress.org/support/topic/language-switcher-in-widget-horizontal/
-
Remove border from language switcherhttps://wordpress.org/support/topic/remove-border-from-language-switcher/
-
Insert langauge switcher withouth php or widgethttps://wordpress.org/support/topic/insert-langauge-switcher-withouth-php-or-widget/
-
Accesibilityhttps://wordpress.org/support/topic/accesibility-3/
-
I can’t put a language menu on my websitehttps://wordpress.org/support/topic/i-cant-put-a-language-menu-on-my-website/