How to find attachment ID for first image in a post

you can use this snippet to get the first image of a post attachment id:

$images =& get_children( 'post_type=attachment&post_mime_type=image&post_parent=" . $postID );
$attachment_id = $images[0]->ID;

Leave a Comment