Popular plugin WPML, which makes WordPress run in multilingual mode, in current (2.6.1) version has a bug – through JavaScript it redirects from homepage to secondary language.

In general, WPML’s JavaScript-based redirection can be controlled by setting “Browser language redirect” (icl_automatic_redirect), but even when setting it to “Disable browser language redirect” problem remains: when you open up repecka.net (primary content language is Lithuanian), you get redirected to repecka.net/en/, which is secondary site language (English). Then cookie (_icl_current_language) is set and next time in 24 hrs you will not get redirected. Still, this is an irritating bug and has been discussed already by several users in WPML forum.

Fix should be present in version 2.6.2, but until that as quick workaround I suggest disabling Browser Language Redirect from the code – edit inc/browser-redirect.php as follows (comment out like #9):

[code lang=”php”]<?php
// adapted from http://wordpress.org/extend/plugins/black-studio-wpml-javascript-redirect/
// thanks to Blank Studio – http://www.blackstudio.it/

class WPML_Browser_Redirect{

static function init(){
if(!is_admin() && !isset($_GET[‘redirect_to’]) && !preg_match(‘#wp-login\.php$#’, preg_replace("@\?(.*)$@", ”, $_SERVER[‘REQUEST_URI’]))) {
// add_action( ‘wp_print_scripts’, array(‘WPML_Browser_Redirect’, ‘scripts’));

At least on this site workaround works 🙄


I’ve got development version from WPML team, installed and confirm that issue is solved. Therefore currently exist three problem solution options:

  1. Contact WPML support, get development version (it is still tagged as 2.6.1) and install it according to instructions team provides;
  2. Use my workaround (only in case you don’t use/need Browser Language Redirect option);
  3. Wait for WPML 2.6.2 with solution already implemented.