media_send_to_editor filter allows you to modify the HTML attachment markup sent to the editor when inserting media.
It is evaluated in:
wp_ajax_send_attachment_to_editor()in the wp-admin/includes/ajax-actions.php file
media_upload_form_handler()in the wp-admin/includes/media.php file
media_send_to_editor accepts 3 arguments:
$htmlThe unslashed HTML to send to the editor.
$idThe attachment id.
$attachmentAn array of attachment attributes.
The following allows you to disable inserting full-size images into the editor and instead inserts ‘large’ sized images.
View the code example on Gist.Have a suggested improvement? You can fork the Gist and comment back with the link. If all is agreeable, I’ll merge in your changes. Crowd-sourced documentation FTW!