switch_locale хук-событиеWP 4.7.0

Fires when the locale is switched.

Использование

add_action( 'switch_locale', 'wp_kama_switch_locale_action', 10, 2 );

/**
 * Function for `switch_locale` action-hook.
 * 
 * @param string    $locale  The new locale.
 * @param false|int $user_id User ID for context if available.
 *
 * @return void
 */
function wp_kama_switch_locale_action( $locale, $user_id ){

	// action...
}
$locale(строка)
The new locale.
$user_id(false|int)
User ID for context if available.

Список изменений

С версии 4.7.0 Введена.
С версии 6.2.0 The $user_id parameter was added.

Где вызывается хук

WP_Locale_Switcher::switch_to_locale()
switch_locale
wp-includes/class-wp-locale-switcher.php 98
do_action( 'switch_locale', $locale, $user_id );

Где используется хук в WordPress

Использование не найдено.