change_locale action-hookWP 4.7.0

Fires when the locale is switched to or restored.

Usage

add_action( 'change_locale', 'wp_kama_change_locale_action' );

/**
 * Function for `change_locale` action-hook.
 * 
 * @param string $locale The new locale.
 *
 * @return void
 */
function wp_kama_change_locale_action( $locale ){

	// action...
}
$locale(string)
The new locale.

Changelog

Since 4.7.0 Introduced.

Where the hook is called

WP_Locale_Switcher::change_locale()
change_locale
wp-includes/class-wp-locale-switcher.php 235
do_action( 'change_locale', $locale );

Where the hook is used in WordPress

wp-includes/default-filters.php 540
add_action( 'change_locale', 'create_initial_post_types' );
wp-includes/default-filters.php 596
add_action( 'change_locale', 'create_initial_taxonomies' );
wp-includes/default-filters.php 617
add_action( 'change_locale', array( 'WP_Widget_Media', 'reset_default_labels' ) );