Add 'image_add_caption_text' filter for changing the pre-parse caption text before output to the editor.

props collinsinternet, DrewAPicture.
fixes #29607.

git-svn-id: https://develop.svn.wordpress.org/trunk@29753 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2014-09-21 09:55:08 +00:00
parent 191a7ead45
commit 9e673c7eee
1 changed files with 15 additions and 0 deletions

View File

@ -158,6 +158,21 @@ function get_image_send_to_editor($id, $caption, $title, $align, $url='', $rel =
*/
function image_add_caption( $html, $id, $caption, $title, $align, $url, $size, $alt = '' ) {
/**
* Filter 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' filter
* from being evaluated at the end of {@see image_add_caption()}.
*
* @since 4.1.0
*
* @param string $caption The original caption text.
*/
$caption = apply_filters( 'image_add_caption_text', $caption );
/**
* Filter whether to disable captions.
*