Opened 9 years ago
Last modified 6 years ago
#33768 new enhancement
Include image_meta in wp_prepare_attachment_for_js response for images
Reported by: | SteveHoneyNZ | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.4 |
Component: | Media | Keywords: | needs-unit-tests has-patch close |
Focuses: | Cc: |
Description
Currently seems odd that the image_meta array isn't returned in the response from wp_prepare_attachment_for_js for an image.
The function already calls get_attachment_metadata so the image_meta array is readily available.
The meta key is already declared in the response array.
All other mime types populate the meta value in the response array in a similar fashion as my proposal.
I can't see any downside or overhead, and the function becomes much more powerful, particulaly for gallery implenmenations, as a result.
The addition is just three lines (in wp-includes/media.php #L2835 of current version).
Attachments (2)
Change History (7)
#2
@
9 years ago
- Keywords needs-patch needs-unit-tests added
As I also mentioned on #33772, a real patch showing your changes would be nice.
Also, a unit test exists for the wp_prepare_attachment_for_js
function which would need to be extended to reflect this change. You can read this section about automated testing to see what that means. Don't worry if it doesn't work or something, I'm sure someone else could help out too.
Should note the addition is at line 145 of the attached (uploaded only the wp_prepare_attachment_for_js function rather than entire media.php file).