WP_Locale_Switcher::switch_to_user_locale()
Switches the translations according to the given user's locale.
Метод класса: WP_Locale_Switcher{}
Хуков нет.
Возвращает
true|false
. True on success, false on failure.
Использование
$WP_Locale_Switcher = new WP_Locale_Switcher(); $WP_Locale_Switcher->switch_to_user_locale( $user_id );
- $user_id(int) (обязательный)
- User ID.
Список изменений
С версии 6.2.0 | Введена. |
Код WP_Locale_Switcher::switch_to_user_locale() WP Locale Switcher::switch to user locale WP 6.2.2
public function switch_to_user_locale( $user_id ) { $locale = get_user_locale( $user_id ); return $this->switch_to_locale( $locale, $user_id ); }