Hi,
I had in my functions.php a small helper function working on the filter attachment_fields_to_edit which just fills some fields during media upload:
function add_image_attachment_fields_to_edit( $form_fields, $post ) {
//$form_fields['post_content']['value'] = 'my-value';//Description
$img_title = get_the_title($post->ID);
$post_title = get_the_title($post->post_parent);
$img_exif = get_wp_exif_tags($post->ID);
if ($img_title <> ''){$post_title = $post_title .' - ' . $img_title;}
if ($img_exif == ' , ') {$img_exif = '';} else {
if ($post_title <> 'Auto Draft') {$img_exif = ' | ' . $img_exif;}
else {$post_title = '';}
}
$form_fields['image_alt']['value'] = $post_title . $img_exif;
//$form_fields['post_excerpt']['value'] = 'my-value'; //caption
//$form_fields['url']['value'] = 'my-value';
return $form_fields;
}
add_filter("attachment_fields_to_edit", "add_image_attachment_fields_to_edit", 15, 2);
But somehow this is not throwing any error message nor it is working – do you have any idea what might causing this not working?
Thanks, Sebastian