Get All Attachments to a Post [WordPress]
Sometimes you need to get a list of all the attachments to a post, some of which may not be accessible any other way (eg an image attached via media_side_load() which you wish to make the thumbnail). Here’s a useful snippet which grabs all the image attachments…
|
1 |
$attachments = get_children('post_type=attachment&post_mime_type=image&post_parent='. $post_id); |


