Ticket #20003: 20003.2.diff
File 20003.2.diff, 1.9 KB (added by , 13 years ago) |
---|
-
wp-admin/includes/ajax-actions.php
1545 1545 } 1546 1546 1547 1547 if ( set_post_thumbnail( $post_ID, $thumbnail_id ) ) 1548 wp_die( _wp_post_thumbnail_html( $thumbnail_id ) );1548 wp_die( _wp_post_thumbnail_html( $thumbnail_id, $post_ID ) ); 1549 1549 wp_die( 0 ); 1550 1550 } 1551 1551 -
wp-admin/includes/post.php
1143 1143 * @since 2.9.0 1144 1144 * 1145 1145 * @param int $thumbnail_id ID of the attachment used for thumbnail 1146 * @param int $post_id ID of the post associated with the thumbnail, defaults to global $post_ID 1146 1147 * @return string html 1147 1148 */ 1148 function _wp_post_thumbnail_html( $thumbnail_id = null ) {1149 function _wp_post_thumbnail_html( $thumbnail_id = null, $post_id = null ) { 1149 1150 global $content_width, $_wp_additional_image_sizes, $post_ID; 1151 1152 if ( empty( $post_id ) ) 1153 $post_id = $post_ID; 1154 1150 1155 $set_thumbnail_link = '<p class="hide-if-no-js"><a title="' . esc_attr__( 'Set featured image' ) . '" href="' . esc_url( get_upload_iframe_src('image') ) . '" id="set-post-thumbnail" class="thickbox">%s</a></p>'; 1151 1156 $content = sprintf($set_thumbnail_link, esc_html__( 'Set featured image' )); 1152 1157 … … 1158 1163 else 1159 1164 $thumbnail_html = wp_get_attachment_image( $thumbnail_id, 'post-thumbnail' ); 1160 1165 if ( !empty( $thumbnail_html ) ) { 1161 $ajax_nonce = wp_create_nonce( "set_post_thumbnail-$post_ ID" );1166 $ajax_nonce = wp_create_nonce( "set_post_thumbnail-$post_id" ); 1162 1167 $content = sprintf($set_thumbnail_link, $thumbnail_html); 1163 1168 $content .= '<p class="hide-if-no-js"><a href="#" id="remove-post-thumbnail" onclick="WPRemoveThumbnail(\'' . $ajax_nonce . '\');return false;">' . esc_html__( 'Remove featured image' ) . '</a></p>'; 1164 1169 }