Make WordPress Core

Ticket #22774: 22774.patch

File 22774.patch, 1.4 KB (added by sc0ttkclark, 12 years ago)
  • trunk/wp-admin/includes/post.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    225225        }
    226226
    227227        // Attachment stuff
    228         if ( 'attachment' == $post_data['post_type'] && isset( $post_data['_wp_attachment_image_alt'] ) ) {
    229                 $image_alt = get_post_meta( $post_ID, '_wp_attachment_image_alt', true );
    230                 if ( $image_alt != stripslashes( $post_data['_wp_attachment_image_alt'] ) ) {
    231                         $image_alt = wp_strip_all_tags( stripslashes( $post_data['_wp_attachment_image_alt'] ), true );
    232                         // update_meta expects slashed
    233                         update_post_meta( $post_ID, '_wp_attachment_image_alt', addslashes( $image_alt ) );
     228        if ( 'attachment' == $post_data['post_type'] ) {
     229                if ( isset( $post_data[ '_wp_attachment_image_alt' ] ) ) {
     230                        $image_alt = get_post_meta( $post_ID, '_wp_attachment_image_alt', true );
     231
     232                        if ( $image_alt != stripslashes( $post_data['_wp_attachment_image_alt'] ) ) {
     233                                $image_alt = wp_strip_all_tags( stripslashes( $post_data['_wp_attachment_image_alt'] ), true );
     234
     235                                // update_meta expects slashed
     236                                update_post_meta( $post_ID, '_wp_attachment_image_alt', addslashes( $image_alt ) );
     237                        }
    234238                }
    235239
    236240                if ( isset( $post_data['attachments'][ $post_ID ] ) )