Right now, I'm doing:
$posts = get_posts(array('post_type' => 'page', 'post__in' => array(1, 3, 2, 9, 7)));
and am having two issues:
- Post 3 is of
'post_type' => 'post'
, so it doesn't get selected, but I want it! If I leave out'post_type' => 'page'
, then only post 3 is selected (because it must assume 'post_type' => 'post'.). I want to be able to order the posts arbitrarily by their ids. If I knew how to use MySQL, I could do:
SELECT * FROM wp_posts WHERE ID IN (1, 3, 2, 9, 7) ORDER BY FIND_IN_SET(ID, '1,3,2,9,7');
But, how should I do this with WordPress?