do_action( 'wp_media_attach_action', string $action, int $attachment_id, int $parent_id )

Fires when media is attached or detached from a post.


Parameters

$action

Attach/detach action. Accepts 'attach' or 'detach'.

$attachment_id

The attachment ID.

$parent_id

Attachment parent ID.


Source

File: wp-admin/includes/media.php

View on GitHub



Changelog

Changelog
Version Description
5.5.0 Introduced.