im focusing on a wordpress blog tryin to build up a multilanguage system. Whenever the consumer clicks his language button the lang query parameter is put into the url

Ex. localhost/my-blog?lang=es

Everything works.The thing is i've your blog primary menu which has links to various parts of the website which are while using wordpress bloginfo('url') :

Ex. <a href="<?php bloginfo('url');?>/contact-us">contact us</a>

And whenever the consumer choose it's language in the home-page after which clicks "e mail usInch

he receive this wrong link:


which wordpress function you utilize men with this type of things?



I believe this kind of url query will enable you to get into trouble later on, why don't you comply with using whether session value or base cookie to keep the customers choice,

then that method for you to simply then add code for your functions.php file to see the session value or cookie, and return the translation type?

there's also this wordpress plugin xili-language

ie: functions.php

function start_session(){
add_action('init', 'start_session', 1);

function set_lang_pref($lang_pref){       
   if(isset($_GET['lang']) && ($_GET['lang']!=''){
      $setlang = $_GET['lang'];
         case "es" :
         $lang = "es_ES";
      return false;


the code is actually rough, but you get the drift..? keep customers choice, check for your choice,

if it is been set then use that value because the language pref on the website..? else just revert to the default..