image_send_to_editor filter-hookWP 2.5.0

Filters the image HTML markup to send to the editor when inserting an image.

Usage

add_filter( 'image_send_to_editor', 'wp_kama_image_send_to_editor_filter', 10, 9 );

/**
 * Function for `image_send_to_editor` filter-hook.
 * 
 * @param string       $html    The image HTML markup to send.
 * @param int          $id      The attachment ID.
 * @param string       $caption The image caption.
 * @param string       $title   The image title.
 * @param string       $align   The image alignment.
 * @param string       $url     The image source URL.
 * @param string|int[] $size    Requested image size. Can be any registered image size name, or an array of width and height values in pixels (in that order).
 * @param string       $alt     The image alternative, or alt, text.
 * @param string       $rel     The image rel attribute.
 *
 * @return string
 */
function wp_kama_image_send_to_editor_filter( $html, $id, $caption, $title, $align, $url, $size, $alt, $rel ){

	// filter...
	return $html;
}
$html(string)
The image HTML markup to send.
$id(int)
The attachment ID.
$caption(string)
The image caption.
$title(string)
The image title.
$align(string)
The image alignment.
$url(string)
The image source URL.
$size(string|int[])
Requested image size. Can be any registered image size name, or an array of width and height values in pixels (in that order).
$alt(string)
The image alternative, or alt, text.
$rel(string)
The image rel attribute.

Changelog

Since 2.5.0 Introduced.
Since 5.6.0 The $rel parameter was added.

Where the hook is called

get_image_send_to_editor()
image_send_to_editor
wp-admin/includes/media.php 168
$html = apply_filters( 'image_send_to_editor', $html, $id, $caption, $title, $align, $url, $size, $alt, $rel );

Where the hook is used in WordPress

wp-includes/default-filters.php 631
add_filter( 'image_send_to_editor', 'image_add_caption', 20, 8 );