Polylang Plugin

Multilingual WordPress Website Setup with Polylang (English & Arabic)

25 Jun, 25 | Abhishek | 12 | 0 |  1 |  0

Learn how to set up a bilingual WordPress site using Polylang. Solve issues like menu switching, mobile menu logic, and Arabic slug changes.

Creating a bilingual website in WordPress can be seamless with the help of the Polylang plugin. However, while setting it up for a client project with English and Arabic, we encountered a few critical challenges. In this blog, I’ll walk you through the setup process, the real issues we faced, and how we solved them effectively.


Step-by-Step Installation and Setup of Polylang

1. Install the Polylang Plugin

1.1 Go to Plugins > Add New

1.2 Search for Polylang

1.3 Click Install and then Activate

2. Add Languages

2.1 Go to Languages > Languages

2.2 Add your desired languages (in our case: English and Arabic)

2.3 Assign language codes (like en, ar) and text direction (Arabic is RTL)

3. Translate Pages

3.1 Create or duplicate each page for both languages

3.2 Use the language switcher in the editor to link translations

4. Create Separate Menus

4.1 Go to Appearance > Menus

4.2 Create a separate menu for each language (e.g., “Header menu English” and “Header menu Arabic”)

4.3 Assign each to its respective language location


Real Issues Faced and Solutions

Issue #1: Switching to Arabic Redirects to English Menu

Problem:
When switching to Arabic, the menu still showed English links.

Root Cause:
Only one global menu was assigned to the theme’s header.

Solution:
We created separate menus for each language:

→ Header menu English for English

→ Header menu Arabic for Arabic

Then, we mapped them in:
Appearance → Menus → Manage Locations
→ Assign each menu to the correct language location.


Issue #2: Mobile Menu Not Switching Based on Language

Problem:
The mobile menu was not switching as per the selected language — it always showed the English version.

Our Case:
We had 4 menus:

→ Header menu English (Desktop)

→ Header menu Arabic (Desktop)

→ Mobile header English

→ Mobile header Arabic

Root Cause:
The theme’s functions.php didn’t support conditional logic for language-specific mobile menus.

Solution:
We added language-based logic in functions.php:

NOTE:  Replace 10734 and 18465 with your actual header post IDs (can be found in the URL when editing the headers).

Issue #3: Arabic Page Slugs Keep Changing on Update

Problem:
Each time we updated an Arabic page, the slug auto-updated to a long encoded Arabic string.

Solution:

→ WordPress sometimes regenerates slugs automatically when the title is in Arabic.

→ To fix it permanently:

1. Go to Pages > All Pages

2. Hover over the page > Click Quick Edit

3. Manually set a clean slug (e.g., home-arabic)

4. Click Update

This method keeps your slug intact even if the page title is changed later.


Conclusion

While Polylang is powerful for multilingual setups, some themes need fine-tuning, especially for language-specific headers and menus. By:

→ Creating separate menus

→ Writing custom logic in functions.php

→ Using Quick Edit for slugs

...we were able to deliver a smooth bilingual experience with perfect language-based switching, even on mobile.


Have you faced similar Polylang issues?

Let us know your experience or drop your questions below!


Contact Us
COMMENTS

No comments