wp_media_attach_action WordPress Action Hook

The wp_media_attach_action hook allows you to attach files to a post or page using the WordPress media uploader. This hook is triggered when you click the "Attach" button in the media uploader.

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

(string)Attach/detach action. Accepts 'attach' or 'detach'.

$attachment_id

(int)The attachment ID.

$parent_id

(int)Attachment parent ID.


Top ↑

Source

File: wp-admin/includes/media.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
5.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More