diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php index c232d8e6a3..d10b5a5462 100644 --- a/src/wp-includes/media.php +++ b/src/wp-includes/media.php @@ -2720,7 +2720,7 @@ function wp_prepare_attachment_for_js( $attachment ) { $response = array( 'id' => $attachment->ID, 'title' => $attachment->post_title, - 'filename' => wp_basename( $attachment->guid ), + 'filename' => wp_basename( get_attached_file( $attachment->ID ) ), 'url' => $attachment_url, 'link' => get_attachment_link( $attachment->ID ), 'alt' => get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ),