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

WordPress Trac noreply at wordpress.org
Tue Sep 15 12:52:51 UTC 2015


#33878: New function: `get_attachment_image_url()`
------------------------------+------------------------------
 Reporter:  sebastian.pisula  |       Owner:
     Type:  feature request   |      Status:  new
 Priority:  normal            |   Milestone:  Awaiting Review
Component:  Media             |     Version:
 Severity:  normal            |  Resolution:
 Keywords:                    |     Focuses:
------------------------------+------------------------------
Changes (by swissspidy):

 * version:  4.3 =>
 * type:  enhancement => feature request


Old description:

> Function return image attachment url

New description:

 The attached patch adds a new `get_attachment_image_url()` function to
 retrieve the URL for a given attachment size.

--

Comment:

 Note that there's already `wp_get_attachment_url()` and
 `wp_get_attachment_thumb_url()`.

 My suggestion would be to make those functions a wrapper for
 `wp_get_attachment_image_src()` and then add a second `$size` parameter to
 `wp_get_attachment_url()`. Example:


 {{{
 wp_get_attachment_url( $id, $size = 'full' ) { ...
 wp_get_attachment_image_src() … }
 wp_get_attachment_thumb_url( $id ) { return wp_get_attachment_url( $id,
 'thumbnail' ); }
 }}}

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


More information about the wp-trac mailing list