• ced64k

    (@ced64k)


    I defined WP_HOME and WP_SITEURL in my wp-config.php but when I switch my local db to the dev environment, Polylang seems to overwrite these values. For example home_url() still returns the local url. If I save the value in the Polylang’settings tab, that works. Is there a way to force these values ?

    Thanks

    https://wordpress.org/plugins/polylang/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Chouby

    (@chouby)

    Polylang caches these values in a transient. You can reset the cache by just clicking on “save changes” in Polylang settings.

    Is there any simple way to workaround this? It’s really annoying when having 2 versions of website on different subdomains (for developing purposes) with same database.

    Thank you!

    I was able to workaround it by creating a filter for pll_the_language_link and strip domain part from the URL so only the “path” part leaves. I’m doing it like this:

    function vac_language_url($url) {
        // check if URL is passed (it can be null as well)
        if (!empty($url)) {
            $url = parse_url($url);
            // leave only /path?and=query from whole URL,
            // for it would be relative to current domain
            return sprintf('%s%s', $url['path'], $url['query'] ? '?'.$url['query'] : '');
        }
    
        return $url;
    }
    add_filter('pll_the_language_link', 'vac_language_url');

    Is there any better way?

    Plugin Author Chouby

    (@chouby)

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘WP_HOME and WP_SITEURL overwritten by Polylang’ is closed to new replies.