Roots Discourse

Polylang home url's

I’m using bedrock and sage9 with polylang plugin. I use the following polylang function:

// get the home url for the current language
$home_url = pll_home_url();

I developed on a localhost environment, which works fine. Then deployed to my staging environment.
The polylang home url shows the localhost URL (e.g. mysite.localhost/fr). I would expect them to show the staging environment URL (e.g. staging.mysite.com/fr).

Yes, my WP_HOME env variable is set correctly on the staging. Other wordpress generated url’s are working on my staging server.

Anyone knows what is going on here and how to fix this?

EDIT: it seems that polylang saves a number of URL’s in the database. Amongst them the home url, at least when setting the polylang option “The front page url contains the language code instead of the page name or page id”. Disabling this and enabling it back solved my issue. But it’s not a good solutions though. I mean, everytime I’m going to have to migrate databases from one environment to another, I’m gonna have to disable/enable this polylang setting in the wordpress admin.

I’d rather have a decent solution…