I do not know if this problem exists with other situations as well or not, but here is how I have encountered it.

My website's default language is Farsi and I have added English with WPML to it. The problem is that when I load my English links , the basic is_rtl() method still returns true, as if it was not set correctly for English !

and unfortunately this method is way too basic, and lots of css files and other direction related stuff just check this method. so what happens is that in my English pages the direction is still rtl and everything looks mirrored

Any idea ?

1 Answer 1


Could not found why the is_rtl() is not working properly, but found that wpml_is_rtl is doing it's own job,

so by adding this code to theme's functions.php everything seems to work fine:

if ( apply_filters( 'wpml_is_rtl', null) ) {
}else {

function mu_alter_language_attributes($output, $doctype){
    return str_replace('rtl','ltr',$output);

function mu_fix_is_rtl($rtl){
    global $wp_locale;
        $wp_locale->text_direction = 'rtl';
        $wp_locale->text_direction = 'ltr';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.