I logged this first at Polylang but this is more a contact form problem than Polylang.
I just find out about this behaviour. The mailtag [_site_url] function always returns to your default homepage, and not the active homepage.
When sending a french email form using [_site_url], it returns me the English homepage url like
This is wrong and it should be http://www.example.com/fr.
My pll settings:
* The language is set from the directory name in pretty permalinks
* Hide URL language information for default language
* Remove /language/ in pretty permalinks
* The front page url contains the language code instead of the page name or page id
So my french emails display the english homepage URL 🙁
This is the answer from Polylang:
This is not a Polylang bug.
site_url() is allways returning the site url from option table. In your case you can try to use pll_home_url in conjunction with pll_current_language (https://polylang.wordpress.com/documentation/documentation-for-developers/functions-reference/).
So when using the mailtag [_site_url], you should use pll_home_url + pll_current_language. Correct ?
- The topic ‘Mailtag [_site_url] is not returning the localized homepage URL’ is closed to new replies.