diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php
index f747fb5721..6d9d181d25 100644
--- a/wp-admin/includes/media.php
+++ b/wp-admin/includes/media.php
@@ -236,11 +236,9 @@ function get_multimedia_items( $post_id, $errors ) {
if ( empty($attachments) )
return '';
- foreach ( $attachments as $id => $attachment ) {
- $output .= "\n
";
- }
+ foreach ( $attachments as $id => $attachment )
+ if ( $item = get_multimedia_item($id, isset($errors[$id]) ? $errors[$id] : null) )
+ $output .= "\n";
return $output;
}
@@ -418,7 +416,10 @@ function get_attachment_fields_to_edit($post, $errors = null) {
}
function get_multimedia_item( $attachment_id, $errors = null, $send = true ) {
- $thumb_url = array_shift(get_attachment_icon_src( $attachment_id ));
+ if ( ( $attachment_id = intval($attachment_id) ) && $thumb_url = get_attachment_icon_src( $attachment_id ) )
+ $thumb_url = $thumb_url[1];
+ else
+ return false;
$title_label = __('Title');
$description_label = __('Description');