Opened 14 years ago
Closed 14 years ago
#19282 closed defect (bug) (fixed)
wp_get_attachment_link() does not allow HTML in link text
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 3.4 | Priority: | normal |
| Severity: | normal | Version: | 2.8 |
| Component: | General | Keywords: | has-patch commit |
| Focuses: | Cc: |
Description
Attachments (2)
Change History (7)
#3
@
14 years ago
I don't see a reason to escape the text here. If someone calls wp_get_attachment_link() with <script> tags, they could as well insert them into the template file directly.
That would be inconsistent with other *_link() functions which don't escape anchor text:
the_feed_link()post_comments_feed_link()edit_term_link()edit_post_link()edit_comment_link()edit_bookmark_link()adjacent_post_link()get_next_posts_link()get_previous_posts_link()get_next_comments_link()get_previous_comments_link()
Note: See
TracTickets for help on using
tickets.
Letting straight HTML come through doesn't seem like the safest way to go. Why not just filter using
wp_kses_post()? Not escaping allows for <script> tags to pass through, so if we want to add HTML, let's at least filter what type of HTML tags can come through. I've attached an updated diff for it.