Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: wp_media_attach_action

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
3811                /**
3812                 * Fires when media is attached or detached from a post.
3813                 *
3814                 * @since 5.5.0
3815                 *
3816                 * @param string $action        Attach/detach action. Accepts 'attach' or 'detach'.
3817                 * @param int    $attachment_id The attachment ID.
3818                 * @param int    $parent_id     Attachment parent ID.
3819                 */
3820                do_action( 'wp_media_attach_action', $action, $attachment_id, $parent_id );
3821
3822                clean_attachment_cache( $attachment_id );
3823           }
3824
3825           $location = 'upload.php';
3826           $referer  = wp_get_referer();
3827
3828           if ( $referer ) {
3829                if ( false !== strpos( $referer, 'upload.php' ) ) {