do_action( "rest_insert_{$this->post_type}", WP_Post $post, WP_REST_Request $request, bool $creating )

Fires after a single post is created or updated via the REST API.

Description

The dynamic portion of the hook name, $this->post_type, refers to the post type slug.

Possible hook names include:

  • rest_insert_post
  • rest_insert_page
  • rest_insert_attachment

Parameters

$post

(WP_Post) Inserted or updated post object.

$request

(WP_REST_Request) Request object.

$creating

(bool) True when creating a post, false when updating.

Source

File: wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php

View on Trac

Changelog

Version Description
4.7.0 Introduced.

© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/hooks/rest_insert_this-post_type