Ticket #16391: 16391.3.diff
File 16391.3.diff, 1.6 KB (added by , 12 years ago) |
---|
-
wp-includes/post.php
204 204 return false; 205 205 206 206 $file = apply_filters( 'update_attached_file', $file, $attachment_id ); 207 $file = _wp_relative_upload_path($file); 208 209 return update_post_meta( $attachment_id, '_wp_attached_file', $file ); 207 if ( $file = _wp_relative_upload_path( $file ) ) 208 return update_post_meta( $attachment_id, '_wp_attached_file', $file ); 209 else 210 return delete_post_meta( $attachment_id, '_wp_attached_file' ); 210 211 } 211 212 212 213 /** … … 4016 4017 if ( !$post = get_post( $post_id ) ) 4017 4018 return false; 4018 4019 4019 $data = apply_filters( 'wp_update_attachment_metadata', $data, $post->ID ); 4020 4021 return update_post_meta( $post->ID, '_wp_attachment_metadata', $data); 4020 if ( $data = apply_filters( 'wp_update_attachment_metadata', $data, $post->ID ) ) 4021 return update_post_meta( $post->ID, '_wp_attachment_metadata', $data ); 4022 else 4023 return delete_post_meta( $post->ID, '_wp_attachment_metadata' ); 4022 4024 } 4023 4025 4024 4026 /** … … 5218 5220 $post = get_post( $post ); 5219 5221 $thumbnail_id = absint( $thumbnail_id ); 5220 5222 if ( $post && $thumbnail_id && get_post( $thumbnail_id ) ) { 5221 $thumbnail_html = wp_get_attachment_image( $thumbnail_id, 'thumbnail' ); 5222 if ( ! empty( $thumbnail_html ) ) { 5223 if ( $thumbnail_html = wp_get_attachment_image( $thumbnail_id, 'thumbnail' ) ) 5223 5224 return update_post_meta( $post->ID, '_thumbnail_id', $thumbnail_id ); 5224 } 5225 else 5226 return delete_post_meta( $post->ID, '_thumbnail_id' ); 5225 5227 } 5226 5228 return false; 5227 5229 }