Ticket #17895: 17895.diff
File 17895.diff, 1.3 KB (added by , 13 years ago) |
---|
-
wp-includes/post.php
5191 5191 } 5192 5192 5193 5193 /** 5194 * Removes a post thumbnail. 5195 * 5196 * @since 3.3.0 5197 * 5198 * @param int|object $post Post ID or object where thumbnail should be removed from. 5199 * @return bool True on success, false on failure. 5200 */ 5201 function delete_post_thumbnail( $post ) { 5202 $post = get_post( $post ); 5203 if ( $post ) { 5204 $thumbnail_id = get_post_meta( $post->ID, '_thumbnail_id', true ); 5205 if ( ! empty( $thumbnail_id ) ) { 5206 return delete_post_meta( $post->ID, '_thumbnail_id' ); 5207 } 5208 return true; 5209 } 5210 return false; 5211 } 5212 5213 /** 5194 5214 * Returns a link to a post format index. 5195 5215 * 5196 5216 * @since 3.1.0 -
wp-admin/admin-ajax.php
1473 1473 check_ajax_referer( "set_post_thumbnail-$post_ID" ); 1474 1474 1475 1475 if ( $thumbnail_id == '-1' ) { 1476 delete_post_meta( $post_ID, '_thumbnail_id' ); 1477 die( _wp_post_thumbnail_html() ); 1476 if ( delete_post_thumbnail( $post_ID ) ) 1477 die( _wp_post_thumbnail_html() ); 1478 else 1479 die( '0' ); 1478 1480 } 1479 1481 1480 1482 if ( set_post_thumbnail( $post_ID, $thumbnail_id ) )