image_add_caption_text
Filters the caption text.
Note: If the caption text is empty, the caption shortcode will not be appended to the image HTML when inserted into the editor.
Passing an empty value also prevents the image_add_caption_shortcode Filters from being evaluated at the end of image_add_caption().
Использование
add_filter( 'image_add_caption_text', 'wp_kama_image_add_caption_text_filter', 10, 2 ); /** * Function for `image_add_caption_text` filter-hook. * * @param string $caption The original caption text. * @param int $id The attachment ID. * * @return string */ function wp_kama_image_add_caption_text_filter( $caption, $id ){ // filter... return $caption; }
- $caption(строка)
- The original caption text.
- $id(int)
- The attachment ID.
Список изменений
С версии 4.1.0 | Введена. |
Где вызывается хук
wp-admin/includes/media.php 204
$caption = apply_filters( 'image_add_caption_text', $caption, $id );