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
$html
The HTML link markup to send to the editor. - string
$url
The media item source URL. - string
$title
The 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.
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!