#33: media_send_to_editor

The media_send_to_editor filter allows you to modify the HTML attachment markup sent to the editor when inserting media.

It is evaluated in:

media_send_to_editor accepts 3 arguments:

  1. string $html The unslashed HTML to send to the editor.
  2. int $id The attachment id.
  3. array $attachment An array of attachment attributes.

Example:

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!

Leave a Reply

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