found a solution: thought it might be worth sharing…
//// We use $gallery_media as an array containing all attachment IDs that have been approved by the admin before
$args = array(
'post_type' => 'attachment',
'posts_per_page' => -1,
'orderby' => 'post_date',
'order' => 'ASC',
'post_status' =>'any',
'post_parent' => $post->ID,
// This queries a custom field I created for media attachments – can be either 'piúblished' or 'pending'
'meta_query' => array(
array(
'key' => 'attachment_status',
'value' => 'published',
)
)
);
$attachments = get_posts( $args );
if ( $attachments ) {
$gallery_media = array();
foreach ( $attachments as $attachment ) {
// Check if attachment has been reviewed and custom status is "published"
// Put together our array
$gallery_media[] = apply_filters( 'id' , $attachment->ID );
}
}
// Outputs an indexed array containing attachment IDs according to our query