do_action( 'rest_insert_attachment', WP_Post $attachment, WP_REST_Request $request, bool $creating )
- Since
- 4.7.0
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.
Fired at · 1
wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php:405WP_REST_Attachments_Controller::insert_attachment()
Source
* @since 4.7.0 * * @param WP_Post $attachment Inserted or updated attachment object. * @param WP_REST_Request $request The request sent to the API. * @param bool $creating True when creating an attachment, false when updating. */ do_action( 'rest_insert_attachment', $attachment, $request, true ); return array( 'attachment_id' => $id, 'file' => $file, ); }History
Introduced in 4.7.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.0.4 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.