Get attachments from a post

I created a snippet to get all attachment from a post, included attachments from comments.
‘posts_per_page’ => -1,
‘post_parent’ => $post->ID

)); ?>
<ul class=”attach-list-post”>
foreach ( $post_attachments as $post_attachment ) {
$name = $post_attachment->post_title;
$date = $post_attachment->post_date;
echo ‘<li>’ . wp_get_attachment_link( $post_attachment->ID, ”, false, false ) . $name . $date . ‘</li>’;

It returns also the date of the attachment.
Now, I need to return also the username of the user who attached the file, that can be the user who commented the post.
I’ve tried using:

$author = $post_attachment->post_author;

but it doesn’t return any kind of value.

Any suggestion on this?

Read more here:: Get attachments from a post

Leave a Reply

Your email address will not be published. Required fields are marked *