Is there a way to fetch the URLs of ALL images in the media gallery?
I think this would be an easy way for a website to have a Pictures page that just pulls all of the images from the media gallery, granted it would only be necessary in certain scenarios.
I don’t need instructions on how to create a Pictures page, just how to pull all of the image URLs. Thanks!
All the images url are now in
$images
;Query the db for all media library items (not just ones attached to posts), grab their url, dump them all in
$list
array.This pulls all attachments for a post/page.
Attach more images to a post, and it will be listed
ok y used this code for show ALL images in media Library!
and if you know method for show pagination, please answer.
This is just a shorter version of this answer using
get_posts()
andarray_map()
.It looks as though it hasn’t been updated in a while, but the Media Library Gallery plugin might be a good example to start looking at.