How to change language file used by _e function

Actually you need to hook in the ‘locale’ filter to set the language you want:

add_filter('locale', function($locale) {
    return esc_attr($_GET['language']);
});

Then in the links of your switch, you need to pass the language variable:

<a href="https://wordpress.stackexchange.com/questions/260015/<?php echo add_query_arg("language', 'xx_XX') ?>">XX</a>

Where xx_XX is the language locale code for language XX

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)