[wp-trac] [WordPress Trac] #30180: wp_get_attachment_image_src does not return alt or meta
WordPress Trac
noreply at wordpress.org
Thu Feb 21 15:36:15 UTC 2019
#30180: wp_get_attachment_image_src does not return alt or meta
-------------------------------------------------+-------------------------
Reporter: joedolson | Owner: joedolson
Type: enhancement | Status: accepted
Priority: normal | Milestone: 5.2
Component: Media | Version:
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests 2nd- | Focuses:
opinion | accessibility
-------------------------------------------------+-------------------------
Comment (by ryanshoover):
@afercia We made the call to go with a new function for getting the alt
text because of limitations in `wp_get_attachment_image_src`. As
@joemcgill points out, the function's name doesn't lend itself to getting
extra information about an image other than its `src` attribute.
Additionally, it returns results in an indexed array where the developer
has to know which "magic number" index attribute refers to which property.
In terms of expanding the current function vs adding a new one - any
developer looking get the alt attribute from this ticket's specs will need
to write new code anyway. I don't see it as a big leap to ask them to use
a new function, rather than have them look for a 4th entry in
`wp_get_attachment_image_src`.
Is there a chance that expanding the return value of
`wp_get_attachment_image_src` may break poorly written code? If someone is
simply looping through the results to generate their image tag, we may
inadvertantly break their tag generation with a 4th option.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/30180#comment:42>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list