Function: wp_media_attach_action

wp_media_attach_action( integer $parent_id, string $action )

Encapsulate logic for Attach/Detach actions

Parameters

Name Type(s) Default Value Description
$parent_id integer

Attachment parent ID.

$action string 'attach'

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

WordPress Developer Newsletter

Stay on top of the latest WordPress API changes, developer tool updates, security alerts and more.