WordPress.org

Make WordPress Core

Ticket #22768: 22768.diff

File 22768.diff, 1.1 KB (added by beaulebens, 7 years ago)

Moves 'caption' from EXIF/IPTC information into the post_excerpt, which is used for the caption field. Also removes one extraneous $content=;

  • src/wp-admin/includes/media.php

     
    223223        $file = $file['file'];
    224224        $title = $name;
    225225        $content = '';
     226        $excerpt = '';
    226227
    227228        if ( preg_match( '#^audio#', $type ) ) {
    228229                $meta = wp_read_audio_metadata( $file );
     
    230231                if ( ! empty( $meta['title'] ) )
    231232                        $title = $meta['title'];
    232233
    233                 $content = '';
    234 
    235234                if ( ! empty( $title ) ) {
    236235
    237236                        if ( ! empty( $meta['album'] ) && ! empty( $meta['artist'] ) ) {
     
    281280                if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) )
    282281                        $title = $image_meta['title'];
    283282                if ( trim( $image_meta['caption'] ) )
    284                         $content = $image_meta['caption'];
     283                        $excerpt = $image_meta['caption'];
    285284        }
    286285
    287286        // Construct the attachment array
     
    291290                'post_parent' => $post_id,
    292291                'post_title' => $title,
    293292                'post_content' => $content,
     293                'post_excerpt' => $excerpt,
    294294        ), $post_data );
    295295
    296296        // This should never be set as it would then overwrite an existing attachment.