wp_after_insert_post() – Fires actions after a post, its terms and meta data has been saved.

You appear to be a bot. Output may be restricted

Description

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

Usage

wp_after_insert_post( $post, $update, $post_before );

Parameters

$post
( int|WP_Post ) required – The post ID or object that has been saved.
$update
( bool ) required – Whether this is an existing post being updated.
$post_before
( null|WP_Post ) required – Null for new posts, the WP_Post object prior to the update for updated posts.

Returns

void

Source

File name: wordpress/wp-includes/post.php
Lines:

1 to 21 of 21
function wp_after_insert_post( $post, $update, $post_before ) {
  $post = get_post( $post );
  if ( ! $post ) {
    return;
  }

  $post_id = $post->ID;

  
/**
 * Fires once a post, its terms and meta data has been saved.
 *
 * @since 5.6.0
 *
 * @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.
 */
  do_action( 'wp_after_insert_post', $post_id, $post, $update, $post_before );
}
 

 View on GitHub View on Trac