Remove links to media files

This isn’t retroactive so it may not help if you have countless pages or posts already created in this way.  But if you would rather WordPress not hyperlink every image you place on the page, this is a way to do it on the theme level.

Add this to your functions.php file.

 * Remove links to media files (images)
 * ----------------------------------------------------------------------------
function wpb_imagelink_setup() {
    $image_set = get_option( 'image_default_link_type' );

    if ($image_set !== 'none') {
        update_option('image_default_link_type', 'none');
 }  }

add_action('admin_init', 'wpb_imagelink_setup', 10);