changing option for all posts
In the option table image_default_link_type is the key for that setting. So you can change its value with filtering. Please see below example. add_filter( ‘option_image_default_link_type’, function () { return ‘file’; }); With this, file will be selected by default when you insert media attachment.