When a user upload images, by default, the Attachment Post URL option is selected. How can I change the default to be "File URL"? If that is not possible, how can I remove the attachment post url completely?
I made a Google search that brought more questionmarks than answers.
EDIT:
I found a way to disable the attachment post URL, this code works:
add_filter('attachment_fields_to_edit', 'my_attachment_fields_edit', 10, 2);
function my_attachment_fields_edit($form_fields,$post){
//Set attachment link to none and hide it.
$html = "<input type='hidden' name='attachments[".$post->ID."][url]' value=''/>";
$form_fields['url']['html'] = $html; //Replace html
$form_fields['url']['label'] = ''; //Remove label
$form_fields['url']['helps'] ='';//Remove help text
return $form_fields;
}
However I am still looking for a way to change which one is set as default.
wp-admin/includes/media.php
), seems that's not possible. The linked search query only return 7 results, take a look to see if you can extract something from those.