Support » Plugin: WP REST API (WP API) » Get multiple posts/media by ID

  • Resolved eigilsagafos



    I’m wondering how I can get multiple media items at a time by their ID? I’m able to get one at a time, and have tried to figure out if there is a way to do it with filters, but no luck so far. When trying to fetch all the images for a post I now have to get them one by one by their ID.

    Any ideas?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Ryan McCue


    You should be able to do it with the post__in filter:

    GET /posts?filter[post__in][]=1&filter[post__in][]=2&filter[post__in][]=3

    We’ve got a documentation ticket open for this too. 🙂


    I can’t seem to get this to work. I’m trying:


    It’s giving me posts with id of 499 and 496, but it’s also giving me every single other post on my site. Any ideas? I haven’t explicity enabled or used sticky posts, if that helps.

    I have the exact same problem. I have tested on a basic install with only 1 post with id 1 and this string /wp-json/posts?filter[post__in][]=2 still returns that post, which it shouldn’t AFAIK.

    Is this something that is fixed in the version not yet pushed to the wordpress repo?

    I am testing this issue.

    This should return the post with id 4824
    But this is returning other posts. Seems this filter is not applied.
    Any helped in this ?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Get multiple posts/media by ID’ is closed to new replies.