Opened 9 years ago
Last modified 5 years ago
#33468 reviewing enhancement
Add image caption hook
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | |
Component: | Media | Keywords: | 2nd-opinion |
Focuses: | template | Cc: |
Description
There is currently no proper way to hook into image captions.
Image captions are stored into the excerpt of attachments posts but when the caption is retrieved it doesn't go threw any specific filter.
I think it would be nice to have a add_filter ( 'image_caption', 'your_filter' );
or something similar.
This was already discussed here : https://wordpress.org/ideas/topic/add-image-caption-hook#post-28710
Captions are used by multiple themes and plugins. They are fully supported and showed in twenty-fifteen so I think we should be able to properly hook/filter them.
Change History (8)
#2
in reply to:
↑ 1
@
9 years ago
Replying to DrewAPicture:
@guillaumemolter: Would you like to try your hand at Submitting a patch?
I most certainly will! Contributing to Core has been on my bucket list for quite a while now so this might be the perfect occasion!
#3
in reply to:
↑ 1
;
follow-up:
↓ 4
@
9 years ago
Replying to DrewAPicture:
Something to consider is that captions are both output in the editor and on the front-end. When HTML support was added to captions a few (maybe more than a few, I don't remember) versions ago, it kind of introduced a new dynamic in terms of what would be considered valid not to break the editor and/or gallery shortcodes on display.
I would thing that any kind of filter added to the caption output would have to keep both front-end and editor use-cases in mind.
Thank you for the feedback I'll make sure to take this into consideration. I'll study how Core is currently handling Captions as well as how other filters work. Can you think of a similar filter that I can use as a reference?
#4
in reply to:
↑ 3
@
9 years ago
- Keywords needs-patch added
Replying to guillaumemolter:
Thank you for the feedback I'll make sure to take this into consideration. I'll study how Core is currently handling Captions as well as how other filters work. Can you think of a similar filter that I can use as a reference?
Not off the top of my head, unfortunately.
#5
@
9 years ago
- Milestone changed from Awaiting Review to Future Release
@guillaumemolter: check out 'wp_video_shortcode'
filter.
Something to consider is that captions are both output in the editor and on the front-end. When HTML support was added to captions a few (maybe more than a few, I don't remember) versions ago, it kind of introduced a new dynamic in terms of what would be considered valid not to break the editor and/or gallery shortcodes on display.
I would thing that any kind of filter added to the caption output would have to keep both front-end and editor use-cases in mind.
@guillaumemolter: Would you like to try your hand at Submitting a patch?