Opened 11 years ago
Closed 11 years ago
#32877 closed enhancement (wontfix)
Added filter in wp_get_attachment_image
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | |
| Component: | Media | Keywords: | needs-patch close |
| Focuses: | Cc: |
Description
There should be a filter in wp_get_attachment_image function to filter the full html. I know that you can add attributes to the tag using wp_get_attachment_image_attributes. But this doesn't allow you to change the tag or wrap the tag in a div for example.
This would bring into line with other filters such as, post_thumbnail_html, script_loader_tag and style_loader_tag.
Change History (3)
#2
@
11 years ago
- Keywords needs-patch close added
wp_get_attachment_image() is kinda gross already - I would probably lean towards the advice in comment:1
#3
@
11 years ago
- Milestone Awaiting Review deleted
- Resolution set to wontfix
- Status changed from new to closed
Filtering on fully formed HTML is unpleasant, both for developers and for maintainers - it's preferable to take a look at what you're really solving for and consider what might be a more targeted and sustainable solution.
Note: See
TracTickets for help on using
tickets.
This could be somehow lead to several problems for displaying the image. The
wp_get_attachment_image()is used in backend on several pages such as the upload.php, post-new/post.php metabox for post thumbnail and in frontend e.G the default Gallery-Shortcode,get_post_thumbnail(),wp_get_attachment_link(), ...If you have some specific output on your page, you can use the
wp_get_attachment_image_src()to produce your own markup or just addecho '<div>' . wp_get_attachment_image( ... ) . '</div>';to your output.