Home›Support›English Support›[Waiting for user feedback] Issue with Automatic Browser Language Redirect (Site Crash) & Query regarding Homepage-only redirect...
[Waiting for user feedback] Issue with Automatic Browser Language Redirect (Site Crash) & Query regarding Homepage-only redirect...
This is the technical support forum for WPML - the multilingual WordPress plugin.
Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.
Unfortunately, enabling this feature caused severe display errors and ultimately crashed our site. We had to disable it immediately to restore functionality.
Moving forward, we have a specific requirement: Is it possible to apply this automatic browser language redirection strictly to the homepage, rather than globally across the entire site?
If this is achievable (either via WPML settings, a custom snippet, or a specific hook), could you please guide us on how to implement it safely? Our main priority is guaranteeing that this implementation will not negatively impact page rendering, cause further crashes, or degrade the overall performance of the site.
WPML does not currently provide a built-in option to apply browser language redirection only to the homepage. The default automatic browser redirect feature works globally across the site.
However, achieving homepage-only language redirection via custom code/hooks is possible.
You could implement this by:
- checking if the current request is the homepage only
- detecting the browser language
- using WPML language filters/hooks to redirect only on that specific page
Useful WPML hooks/functions for this approach would be:
Combined with standard WordPress conditionals such as:
- `is_front_page()`
- `is_home()`
This allows you to build a much safer/customized redirect logic without globally affecting the entire website.
Please note that writing and implementing custom code is outside the scope of our support, but I hope the suggested hooks and approach help point you in the right direction.
Thank you for getting back to us and for pointing out the correct hooks.
We completely understand your policy regarding custom code. However, since the native WPML browser redirect feature actually crashed our live website, we are very hesitant to write a custom solution from scratch without an official, WPML-approved snippet. We simply cannot risk another critical failure or site crash.
Given the circumstances, would it be possible for you to make an exception and provide us with a complete, working code snippet that combines these hooks safely for the homepage?
Having a solution directly from your team would give us the peace of mind we need to implement this without negatively affecting our site's performance again.
Thank you in advance for your understanding and any extra help you can provide.
I understand your concern, especially after the issue with the built-in redirect feature.
Unfortunately, we are not able to provide or officially support fully custom-developed code solutions beyond general guidance and available hooks/API references. This is mainly because custom implementations are highly dependent on the specific server setup, caching/CDN configuration, active plugins/theme behavior, and overall site architecture.
Also, just to note, this issue normally should not happen with the regular WPML browser language redirect feature, and in most cases it should work fine without causing crashes or rendering issues.
So if you prefer, we can instead focus on checking why the standard redirect is not working correctly on your setup and what exactly is causing the issue there.