qtranslate-xt
qtranslate-xt copied to clipboard
Use of static variable in qtranxf_localeForCurrentLanguage() makes it incompatible with WP switch_to_locale().
Describe the bug
The use of "static $locale_lang;" in qtranxf_localeForCurrentLanguage() makes that function incompatible with the WordPress switch_to_locale() feature.
To Reproduce
Steps to reproduce the behavior:
- Call get_locale().
- Use switch_to_locale() to switch to a different locale().
- Call get_locale().
Because of the "static $locale_lang;" in the qtranxf_localeForCurrentLanguage() filter, get_locale() will always return the old locale (because of the static variable in that filter).
Expected behavior
get_locale() should return the new locale after switching locales.
Screenshots
Debug info
Additional context