qTranslate-XT (eXTended) - reviving qTranslate-X multilingual plugin for WordPress. A new community-driven plugin soon. Built-in modules for WooCommerce, ACF, slugs and others.
GNU General Public License v2.0
545
stars
103
forks
source link
Use of static variable in qtranxf_localeForCurrentLanguage() makes it incompatible with WP switch_to_locale(). #1389
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.
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:
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