diff --git a/wp-includes/post.php b/wp-includes/post.php index 0fda61ab85..575a2fbaea 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -5992,13 +5992,12 @@ function wp_delete_attachment_files( $post_id, $meta, $backup_sizes, $file ) { function wp_get_attachment_metadata( $attachment_id = 0, $unfiltered = false ) { $attachment_id = (int) $attachment_id; - $post = get_post( $attachment_id ); - if ( ! $post ) { + $data = get_post_meta( $attachment_id, '_wp_attachment_metadata', true ); + + if ( empty( $data ) ) { return false; } - $data = get_post_meta( $post->ID, '_wp_attachment_metadata', true ); - if ( $unfiltered ) { return $data; } @@ -6012,7 +6011,7 @@ function wp_get_attachment_metadata( $attachment_id = 0, $unfiltered = false ) { * if the object does not exist. * @param int $attachment_id Attachment post ID. */ - return apply_filters( 'wp_get_attachment_metadata', $data, $post->ID ); + return apply_filters( 'wp_get_attachment_metadata', $data, $attachment_id ); } /** diff --git a/wp-includes/version.php b/wp-includes/version.php index 584b6ae5d3..d44dcc8df2 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.6-alpha-49083'; +$wp_version = '5.6-alpha-49084'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.