Exclude single page from function

That is not the way functions work. You can’t tack part of an if/else query onto the end of a function… at least that kinda looks like what you are doing. Or maybe you’re are trying to us an else without the if… Anyway, the syntax is badly broken.

Here is a cleaned up version that should do what you intended your function to do (I think).

//wraps the permalink around each thumbnail
add_filter( 'post_thumbnail_html', 'my_post_image_html', 10, 3 );
function my_post_image_html( $html, $post_id, $post_image_id ) {
  if(!is_single()) { 
    $html="<a href="".get_permalink($post_id).'" title="'.esc_attr( get_post_field('post_title',$post_id)).'">'.$html.'</a>';
  }
  return $html;
}