[wp-trac] [WordPress Trac] #22075: Allow custom attributes to be set in `wp_get_attachment_link`

WordPress Trac noreply at wordpress.org
Thu Jul 10 13:54:12 UTC 2025


#22075: Allow custom attributes to be set in `wp_get_attachment_link`
-------------------------------------------------+-------------------------
 Reporter:  webord                               |       Owner:  (none)
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:
Component:  Media                                |     Version:  3.4
 Severity:  normal                               |  Resolution:
 Keywords:  dev-feedback has-patch needs-        |     Focuses:
  refresh needs-unit-tests close                 |
-------------------------------------------------+-------------------------
Changes (by callumbw95):

 * keywords:  dev-feedback has-patch needs-refresh needs-unit-tests => dev-
     feedback has-patch needs-refresh needs-unit-tests close


Comment:

 Hi all,

 Just looking over this ticket now, and it's been a while so thought I
 would update the state of this function as it stands now. I have compared
 the function between 3.4 and the latest release and there has been a good
 deal of changes in here since this ticket was raised, including a filter
 for attributes applied to the output html:
 {{{#!php
 <?php
 /**
  * Filters the list of attachment link attributes.
  *
  * @since 6.2.0
  *
  * @param array $attributes An array of attributes for the link markup,
  *                          keyed on the attribute name.
  * @param int   $id         Post ID.
  */
 $attributes = apply_filters( 'wp_get_attachment_link_attributes', array(
 'href' => $url ), $_post->ID );
 }}}
 As of such I believe this issue has been rectified within the code, and is
 no longer in need of a patch, and I have marked this ticket with the
 `close` tag. Please feel free to come back on this ticket if you believe
 otherwise, and we can continue the conversation further. 😃

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


More information about the wp-trac mailing list