Make WordPress Core

Ticket #16391: 16391.2.diff

File 16391.2.diff, 1.2 KB (added by SergeyBiryukov, 12 years ago)
  • wp-includes/post.php

     
    205205
    206206        $file = apply_filters( 'update_attached_file', $file, $attachment_id );
    207207        $file = _wp_relative_upload_path($file);
     208        if ( $file )
     209                return update_post_meta( $attachment_id, '_wp_attached_file', $file );
    208210
    209         return update_post_meta( $attachment_id, '_wp_attached_file', $file );
     211        return false;
    210212}
    211213
    212214/**
     
    39403942                return false;
    39413943
    39423944        $data = apply_filters( 'wp_update_attachment_metadata', $data, $post->ID );
     3945        if ( $data )
     3946                return update_post_meta( $post->ID, '_wp_attachment_metadata', $data );
    39433947
    3944         return update_post_meta( $post->ID, '_wp_attachment_metadata', $data);
     3948        return false;
    39453949}
    39463950
    39473951/**
     
    51865190        $thumbnail_id = absint( $thumbnail_id );
    51875191        if ( $post && $thumbnail_id && get_post( $thumbnail_id ) ) {
    51885192                $thumbnail_html = wp_get_attachment_image( $thumbnail_id, 'thumbnail' );
    5189                 if ( ! empty( $thumbnail_html ) ) {
     5193                if ( $thumbnail_html )
    51905194                        return update_post_meta( $post->ID, '_thumbnail_id', $thumbnail_id );
    5191                 }
    51925195        }
    51935196        return false;
    51945197}