WordPress at a glance

switch_to_locale() WP 1.0

Switches the translations according to the given locale.

  • Global. WP_Locale_Switcher. $wp_locale_switcher

No Hooks.


true/false. True on success, false on failure.


switch_to_locale( $locale );
$locale(string) (required)
The locale.

Code of switch_to_locale: wp-includes/l10n.php VER 4.9.8

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

	return $wp_locale_switcher->switch_to_locale( $locale );

Related Functions

From tag: locale (site language)

More from category: Localization

No comments
    Hello, !     Log In . Register