• 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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Not working for me, either. I am doing sth different with the filter than you, but I dont get an error, and if I print_r with the $form_feilds, the screen stops working and just shows blank empty space.

    Same problem here… ??

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Gumbah & JFrankParnell, create your own threads if you require support. Posting me-too comments doesn’t contribute to the original poster’s issue.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘attachment_fields_to_edit not working with WP 3.5’ is closed to new replies.