activate_{$plugin}

ACTION wp-admin\includes\plugin.php (ligne 703) github
Fires as a specific plugin is being activated. This hook is the "activation" hook used internally by register_activation_hook(). The dynamic portion of the hook name, `$plugin`, refers to the plugin basename. If a plugin is silently activated (such as during an update), this hook does not fire.

Paramètres

Entrée :
$network_wide
Sortie :
@param bool $network_wide Whether to enable the plugin for all sites in the network

Utilisation

// Ajouter une fonction au hook action 'activate_{$plugin}'
add_action('activate_{$plugin}', 'ma_fonction_personnalisee', 10, 1);

function ma_fonction_personnalisee($network_wide) {
    // Votre code ici
    error_log('Hook activate_{$plugin} déclenché');
}

Actualités

Chargement des actualités...