Created
January 30, 2018 17:28
-
-
Save marcosnakamine/525065e15b980a02fea9ef17559e3002 to your computer and use it in GitHub Desktop.
WordPress - Change language programmatically via url
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function wpsx_redefine_locale( $locale ) { | |
$lang = $_GET['lang']; | |
if( $lang == 'en'){ | |
$locale = 'en_US'; | |
} else { | |
$locale = 'pt_BR'; | |
} | |
return $locale; | |
} | |
add_filter( 'locale', 'wpsx_redefine_locale', 10 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment