rest_after_insert_attachment action-hook . WP 5.0.0
Fires after a single attachment is completely created or updated via the REST API.
Usage
add_action( 'rest_after_insert_attachment', 'action_function_name_5576', 10, 3 ); function action_function_name_5576( $attachment, $request, $creating ){ // action... }
- $attachment(WP_Post)
- Inserted or updated attachment object.
- $request(WP_REST_Request)
- Request object.
- $creating(true/false)
- True when creating an attachment, false when updating.
Changelog
Since 5.0.0 | Introduced. |
Where the hook is called
rest_after_insert_attachment
rest_after_insert_attachment
wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php 192
do_action( 'rest_after_insert_attachment', $attachment, $request, true );
wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php 349
do_action( 'rest_after_insert_attachment', $attachment, $request, false );