On this page
do_action( 'rest_insert_attachment', WP_Post $attachment, WP_REST_Request $request, bool $creating )
Fires after a single attachment is created or updated via the REST API.
Parameters
$attachmentWP_Post-
Inserted or updated attachment object.
$requestWP_REST_Request-
The request sent to the API.
$creatingbool-
True when creating an attachment, false when updating.
Source
File: wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php. View all references
do_action( 'rest_insert_attachment', $attachment, $request, true );
Related
Used By
| Used By | Description |
|---|---|
| WP_REST_Attachments_Controller::insert_attachment() wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php | Inserts the attachment post in the database. Does not update the attachment meta. |
Changelog
| Version | Description |
|---|---|
| 4.7.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/hooks/rest_insert_attachment