Post thumbnail removal functionality (only allowed for replacement before). props scribu. see #10928

git-svn-id: https://develop.svn.wordpress.org/trunk@12036 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mark Jaquith
2009-10-15 12:57:16 +00:00
parent 45b4ea5807
commit 0818d29d6e
7 changed files with 38 additions and 6 deletions
+6
View File
@@ -1395,6 +1395,12 @@ case 'set-post-thumbnail':
if ( !current_user_can( 'edit_post', $post_id ) )
die( '-1' );
$thumbnail_id = intval( $_POST['thumbnail_id'] );
if ( $thumbnail_id == '-1' ) {
delete_post_meta( $post_id, '_thumbnail_id' );
die( _wp_post_thumbnail_html() );
}
if ( $thumbnail_id && get_post( $thumbnail_id ) ) {
$thumbnail_html = wp_get_attachment_image( $thumbnail_id, 'thumbnail' );
if ( !empty( $thumbnail_html ) ) {