Skip to content

Instantly share code, notes, and snippets.

@rafasashi
Last active September 21, 2018 10:15
Show Gist options
  • Save rafasashi/0731a5ae1dfa5ccb6de865926155901a to your computer and use it in GitHub Desktop.
Save rafasashi/0731a5ae1dfa5ccb6de865926155901a to your computer and use it in GitHub Desktop.
Add the following code in wp-config.php before requesting wp-settings.php https://code.recuweb.com/get/language-switcher/
// setup the main language from cookies
// to be added in wp-config.php before wp-settings
if( !empty($_COOKIE['lsw_main_lang']) ){
$locale = $_COOKIE['lsw_main_lang'] . '_' . strtoupper($_COOKIE['lsw_main_lang']);
if(!defined('WPLANG'))
define ('WPLANG', $locale);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment