Correctly set Featured Post Image link after removing/updating. fixes #13033. props PotterSys

git-svn-id: http://svn.automattic.com/wordpress/trunk@14731 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
markjaquith 2010-05-18 22:14:52 +00:00
parent 20cb3ed21b
commit ee1ced6ba9
1 changed files with 5 additions and 5 deletions

View File

@ -1462,22 +1462,22 @@ case 'image-editor':
die();
break;
case 'set-post-thumbnail':
$post_id = intval( $_POST['post_id'] );
if ( !current_user_can( 'edit_post', $post_id ) )
$post_ID = intval( $_POST['post_id'] );
if ( !current_user_can( 'edit_post', $post_ID ) )
die( '-1' );
$thumbnail_id = intval( $_POST['thumbnail_id'] );
check_ajax_referer( "set_post_thumbnail-$post_id" );
check_ajax_referer( "set_post_thumbnail-$post_ID" );
if ( $thumbnail_id == '-1' ) {
delete_post_meta( $post_id, '_thumbnail_id' );
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 ) ) {
update_post_meta( $post_id, '_thumbnail_id', $thumbnail_id );
update_post_meta( $post_ID, '_thumbnail_id', $thumbnail_id );
die( _wp_post_thumbnail_html( $thumbnail_id ) );
}
}