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



switch_to_user_locale › WordPress Function

Since6.2.0
Deprecatedn/a
switch_to_user_locale ( $user_id )
Parameters:
  • (int) $user_id User ID.
    Required: Yes
Returns:
  • (bool) True on success, false on failure.
Defined at:
Codex:

Switches the translations according to the given user's locale.



Source

function switch_to_user_locale( $user_id ) {
	/* @var WP_Locale_Switcher $wp_locale_switcher */
	global $wp_locale_switcher;

	if ( ! $wp_locale_switcher ) {
		return false;
	}

	return $wp_locale_switcher->switch_to_user_locale( $user_id );
}