A lightweight WordPress plugin that allows you to use any menu item as a language switcher with Polylang. No shortcodes required—just add CSS classes to your menu items and template parts, and the plugin handles the rest.
- Use any menu item as a language switcher.
- Dynamically updates links to translated pages, posts, and taxonomy terms (categories, tags, etc.).
- Show/hide template parts based on the current language.
- Updates the placeholder text ("LAN" → "EN"/"ES") in navigation menus.
- Copy to
wp-content/plugins/manual-polylang-switcher/. - Activate the plugin.
-
In the WordPress Block Editor (Site Editor or Navigation block), create a Navigation block with a submenu.
-
The parent menu item should display a placeholder: "LAN".
-
Add child menu items for each language (e.g., "EN", "ES").
-
Set the URL of each child to
#. -
Add the following CSS classes to each menu item:
- Parent:
.lang-switcher - Child for English:
.lang-btn lang-en - Child for Spanish:
.lang-btn lang-es - Repeat for other languages.
- Parent:
The JavaScript will automatically update the # links to point to the correct translated URLs.
-
Wrap blocks in a Group (or any container).
-
Add the following CSS classes to each group:
- English version:
lang-part-en lang-hidden - Spanish version:
lang-part-es lang-hidden - Repeat for other languages.
- English version:
-
Place these groups inside a template part (e.g., header, footer).
The plugin will automatically show only the group matching the current language.
- Polylang plugin must be active.
- Works with FSE themes and block-based templates.
GPLv3 or later.