WP Obtenha ID de anexo

get_post_thumbnail_id()
Andrew Lautenbach