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.
Использование
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(строка)
- The caption output.
По умолчанию: '' - $attr(массив)
- Attributes of the caption shortcode.
- $content(строка)
- The image element, possibly wrapped in a hyperlink.
Список изменений
| С версии 2.6.0 | Введена. |
Где вызывается хук
img_caption_shortcode
wp-includes/media.php 2552
$output = apply_filters( 'img_caption_shortcode', '', $attr, $content );