A WordPress-centric search engine for devs and theme authors



wp_after_insert_post ›

Since5.6.0
Deprecatedn/a
wp_after_insert_post ( $post, $update )
Parameters: (2)
  • (int|WP_Post) $post The post ID or object that has been saved.
    Required: Yes
  • (bool) $update Whether this is an existing post being updated.
    Required: Yes
Defined at:
Codex:

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



Source

function wp_after_insert_post( $post, $update ) {
	$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.
	 */
	do_action( 'wp_after_insert_post', $post_id, $post, $update );
}