for a language switcher I need to change the get_locale value to the needed language which works great using this code in my functions.php
add_filter( 'locale', 'set_my_locale' );
function set_my_locale( $lang ) {
$lang= 'en_US';
return $lang;
}
echo get_locale()
results in en_US
as needed, but $locale
still shows the value defined in the wp-config.php
? Using the code below did not help either:
function set_locale_frontend($locale)
{
$lang= 'en_US';
return $lang;
}
add_filter('locale', 'set_locale_frontend');
What am I doing wrong or am I missing to do? Please help! Thanks very much!