I am trying to retrieve all of the images associated with a post. I am able to return the ID and to print the ID but when I try to add it with the arguments for get_posts() it returns an empty array. If i don't include a post_parent it gives me all of my images that I have in my media library not all of the images for the post I am looping over. Am I not looping at the right level?
Ive tried manually adding the ID and it still returns an empty array.
$attachments = get_posts( array(
'post_type' => 'attachment',
'posts_per_page' => 1,
'post_parent' => get_the_ID()
) );
var_dump($attachments);
I am expecting a list of the attachments for the post. I want to grab an image from the attachments and print it to the page. But I keep getting empty arrays. Thanks for any help!