rest_after_insert_(post_type) action-hook . WP 5.0.0
Fires after a single post is completely created or updated via the REST API.
The dynamic portion of the hook name, $this->post_type, refers to the post type slug.
Usage
add_action( 'rest_after_insert_(post_type)', 'action_function_name_2915', 10, 3 ); function action_function_name_2915( $post, $request, $creating ){ // action... }
- $post(WP_Post)
- Inserted or updated post object.
- $request(WP_REST_Request)
- Request object.
- $creating(true/false)
- True when creating a post, false when updating.
Changelog
Since 5.0.0 | Introduced. |
Where the hook is called
rest_after_insert_(post_type)
rest_after_insert_(post_type)
wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php 678
do_action( "rest_after_insert_{$this->post_type}", $post, $request, true );
wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php 832
do_action( "rest_after_insert_{$this->post_type}", $post, $request, false );