diff --git src/wp-admin/includes/media.php src/wp-admin/includes/media.php
index c50666f6eb..8a23c6dc63 100644
|
|
function wp_media_attach_action( $parent_id, $action = 'attach' ) { |
3722 | 3722 | } else { |
3723 | 3723 | $result = $wpdb->query( "UPDATE $wpdb->posts SET post_parent = 0 WHERE post_type = 'attachment' AND ID IN ( $ids_string )" ); |
3724 | 3724 | } |
| 3725 | } |
3725 | 3726 | |
| 3727 | if ( isset( $result ) ) { |
3726 | 3728 | foreach ( $ids as $att_id ) { |
| 3729 | /** |
| 3730 | * Fires when media is attached/detached from a post. |
| 3731 | * |
| 3732 | * @since 5.5 |
| 3733 | * |
| 3734 | * @param string $action Attach/detach action. |
| 3735 | * @param int $att_id The attachment ID. |
| 3736 | * @param int $parent_id Attachment parent ID. |
| 3737 | */ |
| 3738 | do_action( 'wp_media_attach_action', $action, $att_id, $parent_id ); |
| 3739 | |
3727 | 3740 | clean_attachment_cache( $att_id ); |
3728 | 3741 | } |
3729 | | } |
3730 | 3742 | |
3731 | | if ( isset( $result ) ) { |
3732 | 3743 | $location = 'upload.php'; |
3733 | 3744 | $referer = wp_get_referer(); |
3734 | 3745 | |