Polylang语言切换异常求助:默认PL语言无法切换
Hey there, let’s troubleshoot this stubborn Polylang issue you’re dealing with—it’s odd that the English language sticks around even after clearing cookies and trying to switch back to Polish. Let’s break down the most likely causes and fixes to get this sorted:
Possible Causes & Fixes
1. Browser Language Detection Overriding Default Language
Polylang has a setting that prioritizes your browser’s default language over the site’s configured default, which might be forcing the redirect to /en/ every time you visit.
- Head to your WordPress admin → Languages → Settings
- Look for the Browser language detection section:
- If this toggle is on, check your browser’s default language—if it’s set to English, Polylang will keep matching that first. Try turning this toggle off temporarily to see if the Polish default works again.
- If you want to keep browser detection enabled, adjust the Language order to move Polish (PL) to the top of the list, so it takes priority over English/German.
2. Caching (Plugin/CDN) Storing the English Version
Caching plugins or CDNs often hold onto cached versions of pages, including the language-specific path. Even if you clear cookies, the cached /en/ page might keep loading.
- First, clear all cache from your WordPress caching plugin (WP Rocket, W3 Total Cache, etc.)—don’t forget page cache, object cache, and browser cache.
- If you’re using a CDN like Cloudflare, log into your CDN dashboard and clear the global cache. Also, make sure your CDN is configured to recognize Polylang’s
pll_languagecookie, so it serves separate cached versions for each language. - Double-check Polylang’s cache settings: Go to Languages → Settings → Cache and ensure Cache different languages separately is enabled. This tells your caching plugin to create distinct caches for PL/EN/DE.
3. .htaccess/Nginx Rewrite Rules Forcing the /en/ Redirect
Sometimes manual or auto-generated rewrite rules can accidentally force all traffic to the English path.
- For Apache users: Open your root
.htaccessfile and look for rules like this:
If you find such a rule, delete it, save the file, and test your site again. Always back upRewriteRule ^$ /en/ [R=301,L].htaccessbefore editing! - For Nginx users: Check your site’s server configuration file for lines like
return 301 $scheme://$host/en/$request_uri;—remove any such forced redirects and restart Nginx. - You can also try re-saving your Polylang language settings to trigger the plugin to regenerate its default rewrite rules (again, back up first).
4. Language Switcher or Plugin Conflict
A misconfigured language switcher or conflicting plugin might be breaking the language toggle functionality.
- If you’re using Polylang’s default widget: Go to Appearance → Widgets, find the Polylang Language Switcher widget, and verify each language’s URL is correct (Polish should point to
www.mypage.pl/, English towww.mypage.pl/en/). - Do a plugin conflict test: Temporarily disable all plugins except Polylang. If the language switch starts working, re-enable plugins one by one to find the culprit. Common culprits include SEO plugins like Yoast—if you’re using Yoast, go to Yoast SEO → Settings → Advanced → Multilingual and confirm it’s set to integrate with Polylang.
5. Database Storing a Stale Language Preference
In rare cases, Polylang might have stored a wrong language preference in your database that overrides cookies.
- Backup your database first—this is critical!
- Open phpMyAdmin, navigate to your WordPress database:
- Check the
wp_optionstable (your prefix might be different) for thepll_default_languageoption. Ensure its value ispl. - Check the
wp_usermetatable for thepll_languagemeta key linked to your user ID. If it’s set toen, delete that entry or update it topl.
- Check the
Start with the first two fixes—they’re the most common culprits—and work your way down if needed. Let me know if any of these resolve the issue!
内容的提问来源于stack exchange,提问作者wolekpl

