Opened 8 years ago
Closed 8 years ago
#37343 closed defect (bug) (fixed)
wp_get_attachment_link() outputs nothing if the attachment post has no title
Reported by: | henry.wright | Owned by: | wonderboymusic |
---|---|---|---|
Milestone: | 4.7 | Priority: | normal |
Severity: | normal | Version: | 4.5.3 |
Component: | Media | Keywords: | has-patch |
Focuses: | Cc: |
Description
wp_get_attachment_link()
fails to output if the attachment post doesn't have a title.
This doesn't apply to image attachments, but it does apply to PDFs etc.
Attachments (6)
Change History (14)
@
8 years ago
Adds additional check if no title set on non-image attachment, and sets filename as fallback
#4
@
8 years ago
- Keywords needs-refresh added
37343-02.patch looks reversed. Also, please create patches from the root directory of the repository.
#5
@
8 years ago
@Jonnyauk what are your thoughts on using the attachment's file name instead of the guid? Patch incoming...
@
8 years ago
@henry.wright - nice - looks a-little neater as a fallback, I've submitted a new patch (37343-05.patch) which retains the original title, which should be used if available.
Note: See
TracTickets for help on using
tickets.
Confirmed - I've replicated this issue with a non-image file (PDF) with no post title where wp_get_attachment_link() doesn't return link, but it functions correctly with a non-titled image file.
It doe work correctly (non image, no title) if you set the $title parameter - but this should not be required.