WP REST API v2: Getting posts by post ids

Prashanth picture Prashanth · Nov 28, 2016 · Viewed 17.6k times · Source

I'm trying to get all posts by ID's using WP REST API. As per the documentation, we can use filter to use WP Query arguments. Using this with posts end point returns all the posts.

http://demo.wp-api.org/wp-json/wp/v2/posts/?filter[posts__in]=470,469

Answer

HOCiNE BEKKOUCHE picture HOCiNE BEKKOUCHE · Mar 17, 2018

With V2 This is working for me, more butter then adding custom code

http://demo.wp-api.org/wp-json/wp/v2/posts?include[]=470&include[]=469