Ticket #22047: 22407.patch
| File 22407.patch, 1.5 KB (added by , 14 years ago) |
|---|
-
wp-includes/post.php
3740 3740 * @uses $user_ID 3741 3741 * @uses do_action() Calls 'edit_attachment' on $post_ID if this is an update. 3742 3742 * @uses do_action() Calls 'add_attachment' on $post_ID if this is not an update. 3743 * @uses do_action() Calls 'update_post' on $post_ID if this is an update 3744 * @uses do_action() Calls 'save_post' on $post_ID if this is not an update 3743 3745 * 3744 3746 * @param string|array $object Arguments to override defaults. 3745 * @param string$file Optional filename.3747 * @param bool|string $file Optional filename. 3746 3748 * @param int $parent Parent post ID. 3747 3749 * @return int Attachment ID. 3748 3750 */ … … 3785 3787 if ( !empty($ID) ) { 3786 3788 $update = true; 3787 3789 $post_ID = (int) $ID; 3790 $post_before = get_post( $post_ID ); 3788 3791 } else { 3789 3792 $update = false; 3790 3793 $post_ID = 0; … … 3884 3887 update_attached_file( $post_ID, $file ); 3885 3888 3886 3889 clean_post_cache( $post_ID ); 3890 $post = get_post( $post_ID ); 3887 3891 3888 3892 if ( ! empty( $context ) ) 3889 3893 add_post_meta( $post_ID, '_wp_attachment_context', $context, true ); 3890 3894 3891 if ( $update ) {3895 if ( $update ) { 3892 3896 do_action('edit_attachment', $post_ID); 3897 do_action('edit_post', $post_ID, $post); 3898 $post_after = get_post( $post_ID ); 3899 do_action('post_updated', $post_ID, $post_after, $post_before); 3893 3900 } else { 3901 do_action('save_post', $post_ID, $post); 3894 3902 do_action('add_attachment', $post_ID); 3895 3903 } 3896 3904