I have multiple users, that have the ability to upload media. When I look at the media library it shows the file information, and included at the bottom is an “Uploaded By ‘username'”

How can I use this username to loop through the media library and display all images from a user?

Here’s a picture of the information with the media.

media name

1 Answer
1

You can do it via WP_Query loop:

$args = array(
   'author'      => $author_id, // Replace with author id
   'post_status' => 'any',
   'post_type'   => 'attachment'
);
$query = new WP_Query( $args );

More info how to use WP_Query: Codex WP Query

Tags:

Leave a Reply

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