media_send_to_editor хук-фильтрWP 2.5.0

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

Использование

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(строка)
HTML markup for a media item sent to the editor.
$send_id(int)
The first key from the $_POST['send'] data.
$attachment(массив)
Array of attachment metadata.

Список изменений

С версии 2.5.0 Введена.

Где вызывается хук

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

Где используется хук в WordPress

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