wppaste
WordPress

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:346WP_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.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 6.7.7 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.