I use Polylang for translating content on a clients website. However, the client requested that users should be redirect on their initial visit based on their region (by IP address).
I’ve implemented some custom code that works, but it does break tools like PageSpeed. When trying to scan the website, PageSpeed will load for a very long time and eventually gives the error message `Unable to resolve . Try checking the URL for validity.`.
This is my code: [Gist Github])
The function `wp_safe_redirect` is the line that causes it. Somehow I think PageSpeed occurs in a infinite loop, because it can’t set cookies. Can someone help?
[ad_2]