img_caption_shortcode
Filters the default caption shortcode output.
If the filtered output isn't empty, it will be used instead of generating the default caption template.
Usage
add_filter( 'img_caption_shortcode', 'wp_kama_img_caption_shortcode_filter', 10, 3 );
/**
* Function for `img_caption_shortcode` filter-hook.
*
* @param string $output The caption output.
* @param array $attr Attributes of the caption shortcode.
* @param string $content The image element, possibly wrapped in a hyperlink.
*
* @return string
*/
function wp_kama_img_caption_shortcode_filter( $output, $attr, $content ){
// filter...
return $output;
}
- $output(string)
- The caption output.
Default: '' - $attr(array)
- Attributes of the caption shortcode.
- $content(string)
- The image element, possibly wrapped in a hyperlink.
Changelog
| Since 2.6.0 | Introduced. |
Where the hook is called
img_caption_shortcode
wp-includes/media.php 2552
$output = apply_filters( 'img_caption_shortcode', '', $attr, $content );