home_url() always uses default language when providing a slug
-
Loving Polylang, it’s a very straight forward and simple tool to use so far, and for that I applaud you!
I did notice, that you are catching calls to
home_url()
and thathome_url( '/' )
(technically “no slug” provided) will provide you with a link that relates to the current active language, but as soon as you give it an actual slug, it will no longer provide the current language.A real world example, I have a site that has fixed buttons in a widget on the right hand side, the widget is hardcoded to use
home_url( '/opening-hours/' )
.
Now if I visitmysite.com
, this outputsmysite.com/opening-hours/
as expected, but if I access it withmysite.com/nb/
I would expect it to bemysite.com/nb/opening-hours/
, but it ends up still beingmysite.com/opening-hours/
.
- The topic ‘home_url() always uses default language when providing a slug’ is closed to new replies.