[wp-trac] [WordPress Trac] #36246: wp_get_attachment_image should use wp_get_attachment_metadata

WordPress Trac noreply at wordpress.org
Tue Mar 15 07:17:51 UTC 2016


#36246: wp_get_attachment_image should use wp_get_attachment_metadata
-----------------------------+-----------------------------
 Reporter:  JorritSchippers  |      Owner:
     Type:  defect (bug)     |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  Media            |    Version:  4.4.2
 Severity:  normal           |   Keywords:
  Focuses:                   |
-----------------------------+-----------------------------
 `wp_get_attachment_image` uses `get_post_meta( $attachment_id,
 '_wp_attachment_metadata', true )` to fetch attachment meta data, even
 though the function `wp_get_attachment_metadata` does exactly this. This
 means that the filter `wp_get_attachment_metadata` can't be used.

 The function `wp_get_attachment_image` calls both
 `wp_calculate_image_srcset` and `wp_calculate_image_sizes` with the image
 meta data. These two functions specify that their inputs come from
 `wp_get_attachment_metadata`, but this is not the case in practise.


 BTW: media.php contains more situations where `get_post_meta(
 $attachment_id, '_wp_attachment_metadata', true )` could be replaced by
 `wp_get_attachment_metadata($attachment_id)`.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36246>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list