rest_after_insert_attachment action-hookWP 5.0.0

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

This is one of the variants of the dynamic hook rest_after_insert_(post_type)

Usage

add_action( 'rest_after_insert_attachment', 'wp_kama_rest_after_insert_attachment_action', 10, 3 );

/**
 * Function for `rest_after_insert_attachment` action-hook.
 * 
 * @param WP_Post         $post     Inserted or updated post object.
 * @param WP_REST_Request $request  Request object.
 * @param bool            $creating True when creating a post, false when updating.
 *
 * @return void
 */
function wp_kama_rest_after_insert_attachment_action( $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

WP_REST_Posts_Controller::create_item()
rest_after_insert_attachment
WP_REST_Attachments_Controller::create_item()
rest_after_insert_attachment
WP_REST_Attachments_Controller::update_item()
rest_after_insert_attachment
wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php 772
do_action( "rest_after_insert_{$this->post_type}", $post, $request, true );
wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php 214
do_action( 'rest_after_insert_attachment', $attachment, $request, true );
wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php 420
do_action( 'rest_after_insert_attachment', $attachment, $request, false );

Where the hook is used in WordPress

Usage not found.