Polylang Multilingual Plugin Setup for WordPress
Polylang is a free alternative to WPML for creating multilingual WordPress sites. The free version covers most tasks; paid Polylang Pro adds field synchronization, REST API, and WooCommerce support.
How It Works
Polylang does not create separate sites in a network (like Multisite) — it adds languages as a taxonomy to existing posts, pages, and custom types. Each post is tied to a language, and translations are linked together through metadata.
Installation and Initial Setup
The plugin is installed from the WordPress repository for free. After activation:
- Languages → Languages → Add language — select from list (Russian, English, etc.)
- Polylang automatically creates a language URL: subdirectories (
/ru/,/en/) or subdomains - Languages → Settings — set default language, homepage behavior
URL structure is changed in Languages → Settings → URL modifications. The "Directories" option (/en/page/) is recommended for SEO.
Translating Content
In the post list, language flags appear — a pencil icon opens an existing translation, "+" creates a new one. In the editor (or in Gutenberg via panel) — a Polylang block for selecting the post language and linking translations of other languages.
Translating Theme Strings
Languages → String Translations
→ Select group (theme, plugin, or custom)
→ Enter translations for each language
To register a string in PHP:
// Register string on initialization
pll_register_string( 'my-plugin', 'Submit button text', 'my-plugin-strings' );
// Get translated string in template
echo pll__( 'Submit button text' );
// Or via e-function for output
pll_e( 'Submit button text' );
Translating Menus
Polylang allows assigning a separate menu for each language:
Appearance → Menus
→ Create menu "Main Menu RU", link to "Russian" language
→ Create menu "Main Menu EN", link to "English" language
→ Assign both menus to one menu location in theme
Polylang automatically shows the correct menu depending on current language.
Programmatic API
// Current language
$lang = pll_current_language(); // 'ru', 'en', 'de'
// Language of a specific post
$post_lang = pll_get_post_language( $post_id ); // 'ru'
// Get post translation ID
$translated_post_id = pll_get_post( $original_post_id, 'en' );
// Home page for specific language
$home_en = pll_home_url( 'en' );
// All site languages
$languages = pll_languages_list(); // ['ru', 'en', 'de']
Language Switcher Widget
Polylang registers a "Polylang Language Switcher" widget that can be added to any area. Options: show flags, language names, hide current language. In Gutenberg — a "Language Switcher" block.
To insert in an arbitrary template location:
// Output language switcher programmatically
dynamic_sidebar( 'polylang-language-switcher' );
// Or via function (Pro)
pll_the_languages( [
'show_flags' => 1,
'show_names' => 1,
'hide_if_no_translation' => 0,
] );
Polylang Pro and WooCommerce
The free version does not officially support WooCommerce — products, attributes, shipping methods are not fully translated. Polylang Pro (or the Polylang for WooCommerce add-on) adds:
- Product, variation, and attribute translation
- Language-specific carts
- WooCommerce email notification translation
- Stock synchronization between product translations
Free Version Limitations
- No synchronization of custom fields between translations
- No official WooCommerce support
- No translations via REST API (
/wp-json/polylang/v1/) — only in Pro
For a small corporate site without a store, the free version is sufficient.
Timeline
Setting up 2–3 languages, translating existing content up to 30 pages, language switcher — 1 business day. With WooCommerce, custom types, field synchronization — 2–3 days (requires Pro).







