Quantcast
Channel: polylang – WordPress.org Forums
Viewing all articles
Browse latest Browse all 11471

Chouby on "[Plugin: Polylang] Enhance feature "When front page is visited, set language according to browser""

$
0
0

Yes. That would be good to improve the no cookie way of working. However, I would do the test before in the process. In include/core.php, line 399, replace:

$this->curlang = $this->options['hide_default'] && (isset($_COOKIE['wordpress_polylang']) || isset($_COOKIE[PLL_COOKIE])) ?
	$this->get_language($this->options['default_lang']) :
	$this->get_preferred_language(); // sets the language according to browser preference or default language

by:

$this->curlang = $this->options['hide_default'] && ((isset($_SERVER['HTTP_REFERER']) && strpos($_SERVER['HTTP_REFERER'], $this->home) !== false) || isset($_COOKIE['wordpress_polylang']) || isset($_COOKIE[PLL_COOKIE])) ?
	$this->get_language($this->options['default_lang']) :
	$this->get_preferred_language(); // sets the language according to browser preference or default language

Viewing all articles
Browse latest Browse all 11471

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>