Can anyone suggest me what is the function to get all the images stored for wordpress? I just need to list all the images seen under menu Media of the wordpress admin.
Thanks in advance
Can anyone suggest me what is the function to get all the images stored for wordpress? I just need to list all the images seen under menu Media of the wordpress admin.
Thanks in advance
You must be logged in to post a comment.
Uploaded images are stored as posts with the type “attachment”; use get_posts() with the right parameters. In the Codex entry for get_posts(), this example:
…loops through all the attachments and displays them.
If you just want to get images, as TheDeadMedic commented, you can filter with
'post_mime_type' => 'image'
in the arguments.