Make WordPress Core

Opened 4 years ago

Last modified 3 years ago

#36270 new enhancement

Allow filtering of the final HTML output of media related shortcodes

Reported by: gnotaras Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.7.2
Component: Media Keywords: needs-patch
Focuses: Cc:
PR Number:


Sometimes it is required to further process the final HTML output of the media related shortcodes, eg caption or gallery, so as to add extra HTML code such as enclosing div or span elements or just modify the existing HTML code during run time.

For instance the final output of img_caption_shortcode could be filtered:


Passing all relevant image attachment data, like ID and size, would also be very useful.

I hope that I am not missing anything but right now the only way to insert code inside the <figure> or <figcaption> block seems to be the complete override of the img_caption_shortcode function.

Change History (3)

#1 @SergeyBiryukov
4 years ago

  • Component changed from General to Media

Related: #14130, #20230, #29832.

Last edited 3 years ago by SergeyBiryukov (previous) (diff)

#2 @obenland
4 years ago

  • Type changed from defect (bug) to enhancement
  • Version trunk deleted

#3 @desrosj
3 years ago

  • Keywords needs-patch added
  • Version set to 4.7.2
Note: See TracTickets for help on using tickets.