WordPress.org

Make WordPress Core

Changeset 23088


Ignore:
Timestamp:
12/06/2012 03:50:31 AM (5 years ago)
Author:
nacin
Message:

Fix branchhing in edit_post() where attachment_fields_to_save would only run when the alt text was sent. It should run whenever an attachment is saved. props sc0ttclark. fixes #22774.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/post.php

    r22979 r23088  
    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            if ( $image_alt != stripslashes( $post_data['_wp_attachment_image_alt'] ) ) {
     232                $image_alt = wp_strip_all_tags( stripslashes( $post_data['_wp_attachment_image_alt'] ), true );
     233                // update_meta expects slashed
     234                update_post_meta( $post_ID, '_wp_attachment_image_alt', addslashes( $image_alt ) );
     235            }
    234236        }
    235237
Note: See TracChangeset for help on using the changeset viewer.