Action hook 'change_locale'

in WP Core File wp-includes/class-wp-locale-switcher.php at line 300

View Source

change_locale

Action Hook
Description
Fires when the locale is switched to or restored.

Hook Information

File Location wp-includes/class-wp-locale-switcher.php View on GitHub
Hook Type Action
Line Number 300

Hook Parameters

Type Name Description
string $locale The new locale.

Usage Examples

Basic Usage
<?php
// Hook into change_locale
add_action('change_locale', 'my_custom_function', 10, 1);

function my_custom_function($locale) {
    // Your custom code here
}

Source Code Context

wp-includes/class-wp-locale-switcher.php:300 - How this hook is used in WordPress core
<?php
 295  		 *
 296  		 * @since 4.7.0
 297  		 *
 298  		 * @param string $locale The new locale.
 299  		 */
 300  		do_action( 'change_locale', $locale );
 301  	}
 302  }

PHP Documentation

<?php
/**
		 * Fires when the locale is switched to or restored.
		 *
		 * @since 4.7.0
		 *
		 * @param string $locale The new locale.
		 */
Quick Info
  • Hook Type: Action
  • Parameters: 1
  • File: wp-includes/class-wp-locale-switcher.php
Related Hooks

Related hooks will be displayed here in future updates.