#34: $type_send_to_editor_url

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:

$type_send_to_editor_url accepts 3 arguments:

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

Leave a Reply

Your email address will not be published. Required fields are marked *