Remove “Insert from URL” in WordPress

I don’t like pulling images from other sites directly for posts: it’s using the bandwidth from someone else’s website. Instead I’ll save the image, upload it and then credit the image back to the source. I look after a multi-author website and sometimes people forget our policies and I have to edit the post to remove that image URL, download it and upload it. To get around this I wanted to remove the option of “Insert from URL” that’s part of WordPress.

Insert from URL screenshot

A quick search of the internet provided exactly what I needed. Insert this code into your theme’s functions.php file.

add_filter( ‘media_view_strings’, ‘cor_media_view_strings’ );
/**
* Removes the media ‘From URL’ string.
*
* @see wp-includes|media.php
*/
function cor_media_view_strings( $strings ) {
unset( $strings[‘insertFromUrlTitle’] );
return $strings;
}

Worked as advertised.