Title: wp_after_insert_post
Published: December 9, 2020
Last modified: August 20, 2026

---

# do_action( ‘wp_after_insert_post’, int $post_id, WP_Post $post, bool $update, null|WP_Post $post_before )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/hooks/wp_after_insert_post/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/wp_after_insert_post/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/wp_after_insert_post/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/wp_after_insert_post/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/hooks/wp_after_insert_post/?output_format=md#wp--skip-link--target)

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

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/wp_after_insert_post/?output_format=md#parameters)󠁿

 `$post_id`int

Post ID.

`$post`[WP_Post](https://developer.wordpress.org/reference/classes/wp_post/)

Post object.

`$update`bool

Whether this is an existing post being updated.

`$post_before`null|[WP_Post](https://developer.wordpress.org/reference/classes/wp_post/)

Null for new posts, the [WP_Post](https://developer.wordpress.org/reference/classes/wp_post/)
object prior to the update for updated posts.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/wp_after_insert_post/?output_format=md#source)󠁿

    ```php
    do_action( 'wp_after_insert_post', $post_id, $post, $update, $post_before );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/post.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/post.php#L6013)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/post.php#L6013-L6013)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/wp_after_insert_post/?output_format=md#related)󠁿

| Used by | Description | 
| [wp_after_insert_post()](https://developer.wordpress.org/reference/functions/wp_after_insert_post/)`wp-includes/post.php` |

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

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/wp_after_insert_post/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.6.0](https://developer.wordpress.org/reference/since/5.6.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwp_after_insert_post%2F)
before being able to contribute a note or feedback.