image_add_caption_text filter-hookWP 4.1.0

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;
The original caption text.
The attachment ID.


Since 4.1.0 Introduced.

Where the hook is called

wp-admin/includes/media.php 204
$caption = apply_filters( 'image_add_caption_text', $caption, $id );

Where the hook is used in WordPress

Usage not found.