The $type_send_to_editor_url filter allows you to modify the HTML markup sent to the editor when inserting non-image embed links into the editor.
The dynamic $type part of the filter hook accepts file, audio, or video.
Filtering image embed links sent to the editor is handled separately via the image_send_to_editor filter.
It is evaluated in:
wp_ajax_send_link_to_editor()in the wp-admin/includes/ajax-actions.php filewp_media_upload_handler()in the wp-admin/includes/media.php file
$type_send_to_editor_url accepts 3 arguments:
- string
$htmlThe HTML link markup to send to the editor. - string
$urlThe media item source URL. - string
$titleThe media item title.
Example:
The following shows how you might add a data-type attribute (such as for JavaScript manipulation) to a video link when it is inserted into the editor.
View the code example on Gist.