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
Related Posts:
- HTML inside __() or _e() language translation string
- Change language by clicking a button
- How to find a language direction?
- How to have english digits in some posts with an rtl WordPress theme
- How to change the language of the ‘Reset Password’ page
- How to reload wordpress textdomains at runtime
- ‘Trick’ a plugin (WP-Members) to think the blog language has changed for a single page
- Were the language toggles removed from WP recently?
- conditional (theme) language selection at ‘runtime’
- Switch site language to en_ZA
- Can I set is_rtl() to true?
- Changing interface language without multisite
- Wrong WordPress language?
- where to add this filter? in which file should be added?
- how to change fonrs for Indian reqgional language?
- How to add language tags like “” in just some certain pages?
- Theme isn’t multilanguage ready. How can i still add a second language to the site?
- Which language files are loaded?
- Having a two language website
- Translation not working in sprinf variable
- Having problem in using wordpress with an other language
- What is the best option to convert my WordPress website to French Language?
- Rewrite Rule for Multilingual Website, Like qTranslate?
- Best WordPress Localization Plugin? [closed]
- How to get a translated string from a language other than the current one?
- qTranslate get content by language [closed]
- How do I change the language of only the login page?
- Different back-end language for different users?
- How to determine current active language in qtranslate plugin? [closed]
- WPML: getting page title in different language
- Having two different versions of the same post?
- WordPress | Sub-domain switching
- Checking current language in a function
- detect the language a post is written in
- Does changing ‘WPLANG’ in wp-config.php just effect the admin language or does it have other consequences?
- Is there a way to localize role labels?
- How to add just one page in Arabic
- Making a theme multilingual by adding a custom taxonomy to posts and pages called “Languages”?
- One of the messages in .po file doesn’t show up
- Multi-language module in WordPress or Google sites
- Translations does not work with .pot file
- Put an extra check box on “Page Attributes” widget
- Trigger language change in WordPress
- How to change language?
- Why isn’t WMPL correctly redirecting users based on browser language? [closed]
- Why load_textdomain work but not load_plugin_textdomain?
- Language Translation is not working?
- WordPress multilingual site using page-id.php files
- How to use both British and American English?
- What is the correct way for multi-domain and multi-language website?
- Two language versions for each article
- How can I make a site viewable in multiple languages?
- Using categories as multilingual mechanism
- Adding text in more than one language (at the same time)
- Is it possible to temporarily override the language setting?
- Locale switching with a “language” taxonomy
- How to use language files in plugins?
- How to find when qtranslate plugin’s language changes? [closed]
- How to have multiple site (UI) languages?
- How to make a wordpress site multilingual by uploading a translated CSV file that has the traslations?
- Country switcher, then option to choose language for that country [closed]
- WordPress Multilinigual
- Where to modify translation files by _e()
- Multilingual website without third-party plugin
- I display messages using code snippets but how can I use the right language?
- How to set a dual language site in wordpress?
- Translating my custom theme, always translated version?
- WordPress and Localization
- Problems character encoding for pages in multiple languages
- WordPress language switcher doesn’t work
- WPML language tags (Qtranslate feature) [closed]
- How to handle a WordPress blog with articles in different languages?
- I cant test my .po file for Turkish Language
- Why .mo .po files are not working with my site?
- I have English words in Kurdish pages
- Multilingual website with different content and look
- Language setting for Specific WordPress Page
- Localisation and WordPress
- Multilanguage backend interface
- Conditionally change WordPress core language
- How to make a wordpress blog in two different languages?
- how to remember specific action/event for current user?
- Recall translations made with Poedit
- Multi Language and Multi Theme WordPress
- WordPress multi language works in local host but not in the live site?
- Japanese characters not showing properly
- How do I change a plugin language of only one page?
- How to load rtl.css file without changing lanuage to persian in wordpress?
- Hijack site url on sub domain for translation
- Create a category in different language?
- Multilingual WordPress page – using URL to determine language?
- Multi language site using only .mo and WPLANG
- Multilingual website suggestions
- multi-language WordPress site
- WordPress Site in Multiple Languages
- category title and description in multi language issue
- How to make a multilingual wordpress site to be translated one-to-one without much effort and without using translate?
- Use country flag as user avatar based on comments IP address?
- RTL in posts only [closed]
- How to make WP in two languages (e.g. English & Bengali) without plugins