WP_Locale_Switcher::switch_to_user_locale()
Switches the translations according to the given user's locale.
Method of the class: WP_Locale_Switcher{}
No Hooks.
Return
true|false
. True on success, false on failure.
Usage
$WP_Locale_Switcher = new WP_Locale_Switcher(); $WP_Locale_Switcher->switch_to_user_locale( $user_id );
- $user_id(int) (required)
- User ID.
Changelog
Since 6.2.0 | Introduced. |
WP_Locale_Switcher::switch_to_user_locale() WP Locale Switcher::switch to user locale code WP 6.7.1
public function switch_to_user_locale( $user_id ) { $locale = get_user_locale( $user_id ); return $this->switch_to_locale( $locale, $user_id ); }