Opened 10 years ago
Closed 10 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 |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.7 |
| Component: | Media | Version: | 4.5.3 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
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)
@
10 years ago
Adds additional check if no title set on non-image attachment, and sets filename as fallback
#4
@
10 years ago
- Keywords needs-refresh added
37343-02.patch looks reversed. Also, please create patches from the root directory of the repository.
#5
@
10 years ago
@Jonnyauk what are your thoughts on using the attachment's file name instead of the guid? Patch incoming...
@
10 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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
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.