wordpress get posts by id

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.

Related Posts:

  • No Related Posts
This entry was posted in Tech Tips and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *