[wp-hackers] Getting Media all media uploads by author

Daniel Grundel daniel at webpresencepartners.com
Wed Feb 8 22:31:18 UTC 2012


Media uploads are just posts of type *attachment*. So, they're stored in
the posts table and you can use *get_posts*:
http://codex.wordpress.org/Template_Tags/get_posts#Show_all_attachments

The title, caption, and description are stored in standard post fields, but
I don't remember what's what. Do a var_dump of one of the posts you
retrieve (or just poke around your database) to figure it out.

You can get the URL with *wp_get_attachment_url* :
http://codex.wordpress.org/Function_Reference/wp_get_attachment_url

You can get the thumb URL with *wp_get_attachment_thumb_url:*
http://codex.wordpress.org/Function_Reference/wp_get_attachment_thumb_url

Daniel J. Grundel
Web Presence Partners
webpresencepartners.com
daniel at webpresencepartners.com
772 678 0697



On Wed, Feb 8, 2012 at 2:12 PM, Muhammad Ali <mjsafoxy at gmail.com> wrote:

> Hi;
>
> I was wondering how I could get all media uploads by author with the URL
> (w/ thumbnail), title, and perhaps the caption and description. I'm sure
> this is possible, just can't find out how to do it. :p I would like to use
> this on the authors.php page.
>
> Any help would be appreciated.
> Regards
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list