wp_after_insert_post

FUNCTION wp-includes\post.php (ligne 5818) github
Fires when a post is transitioned from one status to another.

Paramètres

Entrée :
$post, $update, $post_before
Sortie :
@param string  $new_status New post status.
@param string  $old_status Old post status.
@param WP_Post $post       Post object.
@param WP_Post $post Post object.
@param int     $post_id    Post ID.
@param WP_Post $post       Post object.
@param string  $old_status Old post status.
@param int|WP_Post  $post        The post ID or object that has been saved.
@param bool         $update      Whether this is an existing post being updated.
@param null|WP_Post $post_before Null for new posts, the WP_Post object prior

Utilisation

// Utilisation de la fonction wp_after_insert_post
$result = wp_after_insert_post($post, $update, $post_before);

if ($result) {
    // Votre logique ici
}

Actualités

Chargement des actualités...