3

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

6

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.