image_add_caption_text WordPress Filter Hook

The image_add_caption_text hook allows you to add a caption to an image in WordPress. This is useful if you want to provide a brief description of the image or if you want to credit the author.

apply_filters( 'image_add_caption_text', string $caption, int $id ) #

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


Top ↑

Parameters

$caption

(string)The original caption text.

$id

(int)The attachment ID.


Top ↑

Source

File: wp-admin/includes/media.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
4.1.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More