Fires on the next WP load after the theme has been switched. The parameters differ according to whether the old theme exists or not. If the old theme is missing, the old name will instead be the slug of the old theme. See {@see 'switch_theme'}.
$old_theme->get( 'Name'
Sortie :
@param string $old_name Old theme name. @param WP_Theme $old_theme WP_Theme instance of the old theme.
// Ajouter une fonction au hook action 'after_switch_theme'
add_action('after_switch_theme', 'ma_fonction_personnalisee', 10, 1);
function ma_fonction_personnalisee($old_theme->get( 'Name') {
// Votre code ici
error_log('Hook after_switch_theme déclenché');
}
Chargement des actualités...