wpdb->posts} WHERE post_type = 'attachment' AND ID NOT IN ( SELECT element_id FROM {$this->wpdb->prefix}icl_translations WHERE element_type='post_attachment' ) "; $orphan_attachments = $this->wpdb->get_var( $orphan_attachments_sql ); ?>