I would like to get 2 images in media by their IDs. If I want to get only one image I would use this code
$args = array( 'p' => 1, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'no_found_rows' => true, 'posts_per_page' => 2, 'post_status' => 'any' ); $query = new WP_Query($args);
How can I do it for 2 images, without double queries?
It would be great if I can pass an array with IDs but
'p' according to Codex can be only integer
'p' => array(1,2),
Read more here: WP_Query attachments by multiple IDs