Display ‘attachment_fields_to_edit’ filter only to the featured image Media

I have a custom drop down list on featured image media Uploader see: http://files.swishdesign.com.au/3aYldZJ

However, i noticed that this custom drop down list actually shows to all media uploader and not only to the featured image. Can anybody advise on how to modify it only for featured image media Uploader?

I have used the ‘attachment_fields_to_edit’ filter to implement the above code. Thanks

here’s the sample code:

function attachment_field_ft( $form_fields, $post ) {
$srcset = wp_get_attachment_image_src($post->ID , $size=’feature-thumb’ );
$form_fields[‘custom_resized_image’] = array(
‘label’ => ‘Featured Image’,
‘input’ => ‘html’,
‘html’ => “<select name=’attachments[{$post->ID}][custom4]’ id=’attachments[{$post->ID}][custom4]’>
<option value=’2′>Use Original Image</option>
<option value=’3′>”.$srcset[0].”</option>


return $form_fields;

add_filter( ‘attachment_fields_to_edit’, ‘attachment_field_ft’, 10, 2 );

Read more here:: Display ‘attachment_fields_to_edit’ filter only to the featured image Media

Leave a Reply

Your email address will not be published. Required fields are marked *