wc_switch_to_site_locale()
Switch WooCommerce to site language.
No Hooks.
Return
null
. Nothing.
Usage
wc_switch_to_site_locale();
Changelog
Since 3.1.0 | Introduced. |
wc_switch_to_site_locale() wc switch to site locale code WC 7.3.0
function wc_switch_to_site_locale() { if ( function_exists( 'switch_to_locale' ) ) { switch_to_locale( get_locale() ); // Filter on plugin_locale so load_plugin_textdomain loads the correct locale. add_filter( 'plugin_locale', 'get_locale' ); // Init WC locale. WC()->load_plugin_textdomain(); } }