#41574 closed enhancement (fixed)
Add filter: wp_get_attachment_link_attributes
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.2 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Media | Keywords: | has-patch has-unit-tests commit needs-dev-note |
Focuses: | Cc: |
Description
Similar to wp_get_attachment_image_attributes, it would be nice to be able to filter the link attributes when getting the attachment link.
Attachments (2)
Change History (18)
This ticket was mentioned in Slack in #core-media by mike. View the logs.
6 years ago
#3
@
6 years ago
- Keywords 2nd-opinion added
Overall I like the idea here. Being able to add classes and such to the <a>
element would be helpful, and with the download attribute gaining browser support, I can see that being useful too.
I do have a small concern here though: The $attr
that’s passed into wp_get_attachment_link()
currently just passes through to wp_get_attachment_image()
. That’s going to be really weird once the links support attributes themselves.
Does anyone have any thoughts on what can be done there to keep back compat and ease confusion? Maybe rename that parameter? Do we need to add yet ANOTHER parameter there for consistency?
This ticket was mentioned in Slack in #core-media by antpb. View the logs.
2 years ago
#5
@
2 years ago
- Milestone changed from Awaiting Review to 6.2
Moving this to 6.2. The changes proposed seem safe and the concerns above seem to be okay. Will investigate.
This ticket was mentioned in Slack in #core by costdev. View the logs.
2 years ago
This ticket was mentioned in PR #3922 on WordPress/wordpress-develop by @costdev.
2 years ago
#8
- Keywords has-unit-tests added
This PR refreshes patch: 41574.2.diff to:
- Fix CS issues.
- Backward compatibility: Use single quotes for attribute values.
- Correct
@since
annotation and remove an empty line from the docblock. - Add tests.
#9
@
2 years ago
@antpb If you get a chance, could you review PR 3922 and see if it's appropriate for commit
?
#10
@
2 years ago
- Keywords commit added
@costdev this looks great! Thank you for adding tests there. Marking commit.
#11
@
2 years ago
- Owner changed from antpb to audrasjb
- Status changed from assigned to accepted
Self assigning as WP 6.2 beta 1 is due in a couple hours.
@audrasjb commented on PR #3922:
2 years ago
#15
committed in https://core.trac.wordpress.org/changeset/55262
#16
@
2 years ago
Added to misc dev note. Draft: https://make.wordpress.org/core/?p=103089&preview=1&_ppp=36765ffd5f
add missing >