[wp-trac] [WordPress Trac] #33878: New function: `get_attachment_image_url()`

WordPress Trac noreply at wordpress.org
Sun Nov 1 01:01:45 UTC 2015


#33878: New function: `get_attachment_image_url()`
------------------------------+-----------------------------
 Reporter:  sebastian.pisula  |       Owner:  wonderboymusic
     Type:  enhancement       |      Status:  reopened
 Priority:  normal            |   Milestone:  4.4
Component:  Media             |     Version:
 Severity:  minor             |  Resolution:
 Keywords:  has-patch         |     Focuses:
------------------------------+-----------------------------

Comment (by SergeyBiryukov):

 Replying to [comment:8 Frank Klein]:
 > You are calling `wp_get_attachment_image_src()`, and then take the first
 element out of the returned array, which is the URL. If you use the second
 and third element, you get sizes. The last argument contains a boolean.
 That is pretty weird, I personally find the way that the function returns
 data very inelegant.

 Yup, I've seen people on support forums trying to use
 `wp_get_attachment_image_src()` as a URL without realizing that it returns
 an array.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/33878#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list