switch_locale

ACTION wp-includes\class-wp-locale-switcher.php (ligne 98) github
Fires when the locale is switched.

Paramètres

Entrée :
$locale, $user_id
Sortie :
@param string    $locale  The new locale.
@param false|int $user_id User ID for context if available.

Utilisation

// Ajouter une fonction au hook action 'switch_locale'
add_action('switch_locale', 'ma_fonction_personnalisee', 10, 1);

function ma_fonction_personnalisee($locale, $user_id) {
    // Votre code ici
    error_log('Hook switch_locale déclenché');
}

Actualités

Chargement des actualités...