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

WordPress Trac noreply at wordpress.org
Wed Mar 4 18:37:10 UTC 2020


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

 * keywords:  needs-patch => has-patch needs-testing


Comment:

 Hello,

 I've updated the listed functions to use the Post ID or Post object. Any
 function that defaulted to the global post will continue to do so. These
 are just the attachment related functions, not any of the post functions.
 I think if we want to modify a list of post related functions to include
 passable objects we should create a separate ticket for that.

 With this patch I've also added an additional post type check so that if
 the `global $post` happens to not be an attachment the functions will
 return `false` instead of whatever the given function may return ( empty
 string or empty array ). Additionally, I've passed the post object to the
 function filter hooks as needed.

 Any attachment functions that I may have missed or were not listed we
 could create separate tickets and handle them on a per function basis.

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


More information about the wp-trac mailing list