Forum Archive - $_GET['glang'] is null or empty on Wordpress PRO version

$_GET['glang'] is null or empty on Wordpress PRO version
Jul 7, 2014 3:53 pm by Salmy
I think nobody else has faced this problem, and it's a very big problem for me since I need to translate the jquery datepicker in different languages. It's doing the translations fine when going to /en/ or /fr/, but for some reason php can't seem to detect the variable $_GET['glang'] well to detect in which language it's displaying the page. Whenever I echo it it comes blank. Any alternatives? It's currently working under Wordpress 3.9.1. Is there any other variable to see? Thank you!
Re: $_GET['glang'] is null or empty on Wordpress PRO version
Jul 7, 2014 3:56 pm by Edvard
Hi, In order to enable that parameter you need to use this rewrite rules in your .htaccess: # gtranslate config RewriteRule ^([a-z]{2}|zh-CN|zh-TW)/([a-z]{2}|zh-CN|zh-TW)/(.*)$ /$1/$3 [R=301,L] RewriteRule ^([a-z]{2}|zh-CN|zh-TW)/([a-z]{2}|zh-CN|zh-TW)$ /$1/ [R=301,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([a-z]{2}|zh-CN|zh-TW)/(.*)$ /gtranslate/translate.php?lang=$1&glang=$1&url=$2 [L,QSA] RewriteRule ^([a-z]{2}|zh-CN|zh-TW)$ /gtranslate/translate.php?lang=$1&glang=$1 [L,QSA] The parameter will be set when the language is selected other than your original. If it is not set, then you may consider it to be your default language. Thanks!
Re: $_GET['glang'] is null or empty on Wordpress PRO version
Jul 7, 2014 5:57 pm by Salmy
OK, I followed the instructions, and it didn't include the glang variable in the rewriterules. Makes sense. Now it works, thank you!
Re: $_GET['glang'] is null or empty on Wordpress PRO version
Jul 7, 2014 8:08 pm by Edvard
You are welcome. Thanks!

SIMILAR TOPICS

wordpress amp link not translateDec 31, 2016 10:11 amReplies: 12Post by: besybuy
Add links to all translated posts on every Wordpress postJan 14, 2019 8:51 pmReplies: 5Post by: ptsniper
Best way to translate a page in WordPress?Jan 7, 2019 11:10 amReplies: 3Post by: Tonnystark
how to translate site right to left for arabic in WordPressDec 26, 2018 9:02 amReplies: 1Post by: Hammond753
G Translate on 2 menus on wordpress (desktop and mobile)Nov 1, 2018 3:33 pmReplies: 1Post by: investatemiami

Try GTranslate with a free 15 day trial