http://example.com/wp-json/wp/v2/posts?author=1
gives me author 1's posts.
http://example.com/wp-json/wp/v2/posts?author=1&author=5
gives me only author 5's posts. Is there any way to get 2 different author's posts with one request?
The author
parameter in your request, seems to be mapped to the author__in
parameter in WP_Query
that runs behind the rest-api call here, where a comma separated input:
/wp-json/wp/v2/posts?author=1,5
is translated to an array( 1,5 )
input for author__in
.
/wp-json/wp/v2/posts?author=1,5