I managed to add a custom option-select for images with
function attachment_field_credit( $form_fields, $post ) {
$field_value = get_post_meta( $post->ID, 'first_image', true );
$isSelected1 = $field_value == '1' ? 'selected ' : '';
$isSelected2 = $field_value != '1' ? 'selected ' : '';
$form_fields['first_image'] = array(
'label' => __( 'Use as first image' ),
'input' => 'html',
'html' => "<select name='attachments[{$post->ID}][first_image]' id='attachments[{$post->ID}][first_image]'>
<option ".$isSelected1." value='1'>Yes</option>
<option ".$isSelected2." value='2'>No</option>
</select>"
);
return $form_fields;
}
add_filter( 'attachment_fields_to_edit', 'attachment_field_credit', 10, 2 );
Now I need to do almost the same for links. So if I click on Pages -> Add New -> Insert / Edit Link
I get this:
Can I add another option-select field for those links? How to do that?