When adding media, can I filter the HTML generated from "Insert From URL" before it hits the editor?

function test_function( $html ) {
   return $html . 'TEST!';
}
add_filter( 'post_thumbnail_html', 'test_function', 21 );
add_filter( 'image_send_to_editor', 'test_function', 21 );
add_filter( 'media_send_to_editor', 'test_function', 21 );

I’ve tried something like the above, but it only edits the HTML of images appended thru the media library, not ones added manually via URL. The goal here is to modify the tag produced so I can add some additional attributes to it. Any ideas?

Read more here: When adding media, can I filter the HTML generated from "Insert From URL" before it hits the editor?

Leave a Reply

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