media_send_to_editor filter-hookWP 2.5.0

Filters the HTML markup for a media item sent to the editor.

Usage

add_filter( 'media_send_to_editor', 'wp_kama_media_send_to_editor_filter', 10, 3 );

/**
 * Function for `media_send_to_editor` filter-hook.
 * 
 * @param string $html       HTML markup for a media item sent to the editor.
 * @param int    $send_id    The first key from the $_POST['send'] data.
 * @param array  $attachment Array of attachment metadata.
 *
 * @return string
 */
function wp_kama_media_send_to_editor_filter( $html, $send_id, $attachment ){

	// filter...
	return $html;
}
$html(string)
HTML markup for a media item sent to the editor.
$send_id(int)
The first key from the $_POST['send'] data.
$attachment(array)
Array of attachment metadata.

Changelog

Since 2.5.0 Introduced.

Where the hook is called

media_upload_form_handler()
media_send_to_editor
wp_ajax_send_attachment_to_editor()
media_send_to_editor
wp-admin/includes/media.php 858
$html = apply_filters( 'media_send_to_editor', $html, $send_id, $attachment );
wp-admin/includes/ajax-actions.php 3370
$html = apply_filters( 'media_send_to_editor', $html, $id, $attachment );

Where the hook is used in WordPress

wp-admin/includes/ajax-actions.php 3343
remove_filter( 'media_send_to_editor', 'image_media_send_to_editor' );
wp-includes/default-filters.php 672
add_filter( 'media_send_to_editor', 'image_media_send_to_editor', 10, 3 );