wp_after_insert_post action-hookWP 5.6.0

Fires once a post, its terms and meta data has been saved.

Usage

add_action( 'wp_after_insert_post', 'wp_kama_after_insert_post_action', 10, 4 );

/**
 * Function for `wp_after_insert_post` action-hook.
 * 
 * @param int          $post_id     Post ID.
 * @param WP_Post      $post        Post object.
 * @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 to the update for updated posts.
 *
 * @return void
 */
function wp_kama_after_insert_post_action( $post_id, $post, $update, $post_before ){

	// action...
}
$post_id(int)
Post ID.
$post(WP_Post)
Post object.
$update(true|false)
Whether this is an existing post being updated.
$post_before(null|WP_Post)
Null for new posts, the WP_Post object prior to the update for updated posts.

Changelog

Since 5.6.0 Introduced.

Where the hook is called

wp_after_insert_post()
wp_after_insert_post
wp-includes/post.php 5393
do_action( 'wp_after_insert_post', $post_id, $post, $update, $post_before );

Where the hook is used in WordPress

Usage not found.