switch_blog

ACTION wp-includes\ms-blogs.php (ligne 527) github
Fires when the blog is switched.

Paramètres

Entrée :
$new_blog_id, $prev_blog_id, 'switch'
Sortie :
@param int    $new_blog_id  New blog ID.
@param int    $prev_blog_id Previous blog ID.
@param string $context      Additional context. Accepts 'switch' when called from switch_to_blog()

Utilisation

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

function ma_fonction_personnalisee($new_blog_id, $prev_blog_id, 'switch') {
    // Votre code ici
    error_log('Hook switch_blog déclenché');
}

Actualités

Chargement des actualités...