apply_filters( ‘image_add_caption_text’, string $caption, int $id )

In this article

Filters the caption text.

Description

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() .

Parameters

$captionstring
The original caption text.
$idint
The attachment ID.

Source

$caption = apply_filters( 'image_add_caption_text', $caption, $id );

Changelog

VersionDescription
4.1.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.