Fix Wordpress Rewrite per language

I'm using this code to rewrite URLs as per language (from here: [login to view URL]):

I do not want the session rules so I excluded them:

function lang_support() {

return array('en','fr'); // Add your support lang-code (1st place is a default)


function rewrite_lang(){

$langs = lang_support();

foreach($langs as $lang) {





function lang(){

global $wp_query;

$langs = lang_support();

$lang_r = "";

foreach($langs as $lang) {

if(isset($wp_query->query_vars[$lang])) {

$lang_r = $lang;

$_SESSION['lang'] = $lang_r;



if(in_array($lang_r,$langs)) {

return $lang_r;

} else {

return $langs[0];



It works just fine for 'en' and 'fr' but when I add more languages (i.e. 'es' and 'it' to the array it fails and brings up a random post.

Please install on your Wordpress and find out what's wrong.

Evner: WordPress, PHP

Se mere: fix wordpress php problems, fix wordpress theme corruption, fix wordpress blog, fix wordpress post count, fix wordpress post html problem, fix wordpress feed, fix wordpress database corrupt, build dual language website turn languages, fix wordpress blog freelancer, fix wordpress changing hosts, fix wordpress script, display post fix wordpress, wordpress rewrite apache work, fix wordpress widgets, fix wordpress php script, wordpress rewrite hack

Om arbejdsgiveren:
( 204 bedømmelser ) San Francisco, United States

Projekt ID: #22417699

Tildelt til:


Hey! This seems to be an easy enough request! I'm very well versed in debugging a multitude of bugs / issues caused by plugins / inefficient code. I have a lot of experience in wordpress so please take a look at Flere

$10 USD på 1 dag
(3 bedømmelser)

5 freelancere byder i gennemsnit $22 på dette job


Hi!! I hope you are doing well!! I have gone through your project requirements. Sure, I will fix your issues as per your needs. I developed many websites you can check my previous work: [login to view URL] Flere

$30 USD på 1 dag
(6 bedømmelser)

Hi I have reviewed your requirements for your preconceived project As all your requirements are crystal clear to me so, I would like to discuss your project querries in more detail which would let me to quote you t Flere

$20 USD in 7 dage
(1 bedømmelse)

Hello, As a talented WordPress expert, I have been working in WordPress for 6+ years and have all the skills WordPress. I feel fit for your project and you will be satisfied with my working. I would like to work on you Flere

$20 USD på 1 dag
(7 bedømmelser)

Hello, We have a team of Professional USA Based expert developers & Designers, who are always ready to work on the inspired and creative needs of the client. Please have a chat with me so that I may be able to further Flere

$30 USD in 3 dage
(0 bedømmelser)