restore_previous_locale

Fires when the locale is restored to the previous one.

Description

do_action( 'restore_previous_locale', (string) $locale, (string) $previous_locale ); 

Parameters (2)

0. $locale (string)
The new locale.
1. $previous_locale (string)
The previous locale.

Usage

To run the hook, copy the example below.
  1. // run the action 
  2. do_action( 'restore_previous_locale', $locale, $previous_locale ); 
The following example is for adding a hook callback.
  1. // define the restore_previous_locale callback 
  2. function action_restore_previous_locale( $locale, $previous_locale ) { 
  3. // make action magic happen here... 
  4. }; 
  5.  
  6. // add the action 
  7. add_action( 'restore_previous_locale', 'action_restore_previous_locale', 10, 2 ); 
To remove a hook callback, use the example below.
  1. // remove the action 
  2. remove_action( 'restore_previous_locale', 'action_restore_previous_locale', 10, 2 ); 

Defined (1)

The action is defined in the following location(s).

/wp-includes/class-wp-locale-switcher.php  
  1. do_action( 'restore_previous_locale', $locale, $previous_locale );