[wp-trac] [WordPress Trac] #37255: wp_get_attachment_caption and post parameter

WordPress Trac noreply at wordpress.org
Fri Jul 15 20:54:03 UTC 2016


#37255: wp_get_attachment_caption and post parameter
-------------------------+-----------------------------
 Reporter:  wido         |       Owner:  joemcgill
     Type:  enhancement  |      Status:  reviewing
 Priority:  normal       |   Milestone:  Future Release
Component:  Media        |     Version:  trunk
 Severity:  normal       |  Resolution:
 Keywords:  needs-patch  |     Focuses:
-------------------------+-----------------------------
Changes (by flixos90):

 * milestone:  4.6 => Future Release


Comment:

 Most similar attachment functions only accept an ID, so I just moved that
 over to the new function for `wp_get_attachment_caption()`. It makes sense
 to improve them to accept not only an ID, but also a post object IMO.

 However, although it is a straightforward fix, it will affect quite a few
 functions that have been around for a longer time. I wouldn't like only
 changing it for `wp_get_attachment_caption()` just because we can (since
 it's new). Because of this broader scope let's think about it in 4.7.
 There needs to be a discussion whether we should change it for all the
 attachment functions or leave it as is.

 While it wouldn't hurt to support objects, I personally never felt
 somewhat limited by using IDs for attachments. Maybe it's just because it
 has already sunk in that attachment functions accept IDs.

 Anyway, the functions that would need to be enhanced would be:

 In `wp-includes/post.php`:
 * `wp_get_attachment_metadata()`
 * `wp_update_attachment_metadata()`
 * `wp_get_attachment_url()`
 * `wp_get_attachment_caption()`
 * `wp_get_attachment_thumb_file()`
 * `wp_get_attachment_thumb_url()`

 In `wp-includes/media.php`:
 * `image_downsize()`
 * `get_image_tag()`
 * `image_get_intermediate_size()`
 * `wp_get_attachment_image_src()`
 * `wp_get_attachment_image()`
 * `wp_get_attachment_image_url()`
 * `wp_get_attachment_image_srcset()`
 * `wp_get_attachment_image_sizes()`

 I might be missing some more. The only attachment function I found that
 supports passing an object is `wp_attachment_is()`.

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


More information about the wp-trac mailing list