Simple solution for the wordpress get_posts
function to get a list of posts by post id / an array of post ids:
$args = array( 'post__in' => array(34,36) );
$posts = get_posts($args);
It’s always really hard for me to remember that crazy post__in
with a double underscore between post
and in
.