change_locale
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
change_locale
wp-includes/class-wp-locale-switcher.php 300
do_action( 'change_locale', $locale );
Where the hook is used in WordPress
wp-includes/default-filters.php 581
add_action( 'change_locale', 'create_initial_post_types' );
wp-includes/default-filters.php 669
add_action( 'change_locale', 'create_initial_taxonomies' );
wp-includes/default-filters.php 688
add_action( 'change_locale', array( 'WP_Widget_Media', 'reset_default_labels' ) );