wpseek.com
A WordPress-centric search engine for devs and theme authors



switch_to_locale › WordPress Function

Since4.7.0
Deprecatedn/a
switch_to_locale ( $locale )
Parameters:
  • (string) $locale The locale.
    Required: Yes
Returns:
  • (bool) True on success, false on failure.
Defined at:
Codex:

Switches the translations according to the given locale.



Source

function switch_to_locale( $locale ) {
	/* @var WP_Locale_Switcher $wp_locale_switcher */
	global $wp_locale_switcher;

	if ( ! $wp_locale_switcher ) {
		return false;
	}

	return $wp_locale_switcher->switch_to_locale( $locale );
}