From 90e5fd56c07b0839945fa303351e58f69d3b040f Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Thu, 6 Dec 2012 03:50:31 +0000 Subject: [PATCH] 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. git-svn-id: https://develop.svn.wordpress.org/trunk@23088 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/post.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php index f0b7b4cded..23cdfc9f7c 100644 --- a/wp-admin/includes/post.php +++ b/wp-admin/includes/post.php @@ -225,12 +225,14 @@ function edit_post( $post_data = null ) { } // Attachment stuff - if ( 'attachment' == $post_data['post_type'] && isset( $post_data['_wp_attachment_image_alt'] ) ) { - $image_alt = get_post_meta( $post_ID, '_wp_attachment_image_alt', true ); - if ( $image_alt != stripslashes( $post_data['_wp_attachment_image_alt'] ) ) { - $image_alt = wp_strip_all_tags( stripslashes( $post_data['_wp_attachment_image_alt'] ), true ); - // update_meta expects slashed - update_post_meta( $post_ID, '_wp_attachment_image_alt', addslashes( $image_alt ) ); + if ( 'attachment' == $post_data['post_type'] ) { + if ( isset( $post_data[ '_wp_attachment_image_alt' ] ) ) { + $image_alt = get_post_meta( $post_ID, '_wp_attachment_image_alt', true ); + if ( $image_alt != stripslashes( $post_data['_wp_attachment_image_alt'] ) ) { + $image_alt = wp_strip_all_tags( stripslashes( $post_data['_wp_attachment_image_alt'] ), true ); + // update_meta expects slashed + update_post_meta( $post_ID, '_wp_attachment_image_alt', addslashes( $image_alt ) ); + } } if ( isset( $post_data['attachments'][ $post_ID ] ) )