Action hook 'restore_previous_locale'

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

View Source

restore_previous_locale

Action Hook
Description
Fires when the locale is restored to the previous one.

Hook Information

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

Hook Parameters

Type Name Description
string $locale The new locale.
string $previous_locale The previous locale.

Usage Examples

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

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

Source Code Context

wp-includes/class-wp-locale-switcher.php:149 - How this hook is used in WordPress core
<?php
 144  		 * @since 4.7.0
 145  		 *
 146  		 * @param string $locale          The new locale.
 147  		 * @param string $previous_locale The previous locale.
 148  		 */
 149  		do_action( 'restore_previous_locale', $locale, $previous_locale[0] );
 150  
 151  		return $locale;
 152  	}
 153  
 154  	/**

PHP Documentation

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

Related hooks will be displayed here in future updates.