I need to get all the images that are uploaded in my wordpress installation using the REST API. I've tried using the wp-json/wp/v2/media endpoint but it will give me only the last 10 images uploaded that are attached to the last published post but this isn't what I was expectinng.

How I can get all the images that are uploaded in wordpress unsing the rest api?

  • 1
    Do you just need to request more pages from the API? Look in the response headers: there should be two headers there with the max number of pages and total number of images. See developer.wordpress.org/rest-api/using-the-rest-api/pagination
    – Rup
    Sep 23, 2020 at 14:41
  • I need to get all the media uploaded. I want to get at least 20 images because I will not query the api more than once, I'm working on a slideshow so I will not have pagination but only x images to display
    – jimmy26
    Sep 23, 2020 at 16:28
  • Try adding ?per_page=20 then, or another limit up to 100. But there's no reason you can't use the API more than once to build up a list in pages, either at the beginning or dynamically as they're needed.
    – Rup
    Sep 23, 2020 at 16:29
  • @Rup solved,thanks for the help. I just need a single ajax call to fetch the images I need for the slider. it will be unuseful for my scope to make multiple ajax calls, it doesn't have any sense in a slider.
    – jimmy26
    Sep 23, 2020 at 16:53

1 Answer 1


add per_page: 100 as params also set page: 1 for first 100 and 2 for next 100

Have a look:- https://i.sstatic.net/Mbd5F.png

  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Feb 5, 2022 at 2:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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