WordPress filter hook · part of WordPress core
media_send_to_editor
A WordPress core filter that 4 plugins also fire themselves, running on 2,600+ sites between them.
“1. Native WordPress Core filter hook: Allows PDF Embedder and any third-party plugin to convert media into shortcodes or custom embeds.”
How to use media_send_to_editor
It's a filter: your callback receives the value and 2 more arguments, and must return the (changed) value.
Add this to your theme's functions.php or a small custom plugin:
add_filter( 'media_send_to_editor', function( $html, $attachment_id, $attachment ) {
// Change $html here.
return $html;
}, 10, 3 );Argument names come from Faster Image Insert's source. Other plugins may pass different values: check the call in the plugin you're targeting below.
This hook is fired by WordPress core too. Official reference on developer.wordpress.org →
4 plugins that fire media_send_to_editor
Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.
-
Faster Image Insert2,000+ installs
apply_filters( 'media_send_to_editor', $html, $attachment_id, $attachment )faster-image-insert.php:278 -
Frontend Dashboard500+ installs
apply_filters( 'media_send_to_editor', $html, $id, $attachment_meta )src/Controllers/Media/MediaController.php:483 -
Canto100+ installs
apply_filters( 'media_send_to_editor', $html, $id, $attachment )includes/lib/media-upload.php:79 -
Scaleflex DAMFewer than 10 installs
apply_filters( 'media_send_to_editor', $html, $id, ["id" => $id] )filerobot_class.php:1642
Need a customisation built on this hook?
Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.