[wp-trac] [WordPress Trac] #51780: Add ability to easily get path to sized images (such as parameter to get_attached_file() or wp_get_attachment_thumb_file())

WordPress Trac noreply at wordpress.org
Tue Feb 28 22:27:43 UTC 2023


#51780: Add ability to easily get path to sized images (such as parameter to
get_attached_file() or wp_get_attachment_thumb_file())
-------------------------------------------------+-------------------------
 Reporter:  paulschreiber                        |       Owner:  joedolson
     Type:  enhancement                          |      Status:  reopened
 Priority:  normal                               |   Milestone:  6.2
Component:  Media                                |     Version:  5.5.3
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch has-unit-tests 2nd-        |     Focuses:
  opinion changes-requested                      |
-------------------------------------------------+-------------------------

Comment (by flixos90):

 Apologies for chiming in late here, just came across this ticket. I agree
 with @azaozz that the idea of adding a `$size` parameter to this function
 conflicts with its purpose. This is a general attachment function, not a
 function for attachment images (or image attachments, whichever you wanna
 call it).

 We have numerous functions specific to image attachments in core already,
 all of which (rightfully!) allow passing the `$size` parameter. But this
 here is not one of them. From the ticket description, I would think the
 `wp_get_attachment_image_url()` function is what should be used for this?
 But even if I'm missing something and maybe a function for something is
 indeed missing in core, we should rather add or modify an image attachment
 specific function, not this general one.

 I think this changeset should be reverted. We can separately continue
 discussing for 6.3 whether the use-case here indeed requires a change, and
 which image function it would best fit into.

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


More information about the wp-trac mailing list