title: How to get Attachment Id of a file uploaded in Wordpress post?
body: <p>I have posts and I upload a file like PDF or MS Word file(Not feature Images) in every post. I want to make downloadable link of that uploaded file. But I can't get attachment ID. Here is my code</p>
  <pre><code>&lt;?php 
  $reports = array(   
   'post_type' =&gt; 'post' , 
   'posts_per_page' =&gt; 3,
   'category_name' =&gt; 'reports'); 
      
   $q_reports = new WP_Query($reports);   
                  
   if($q_reports-&gt;have_posts()){
   while($q_reports-&gt;have_posts()){ 
   $q_reports-&gt;the_post();?&gt; 
  
  &lt;a href=&quot;&lt;?php echo wp_get_attachment_url($attach_id); ?&gt;&quot; &gt;&lt;?php echo the_title(); ?&gt;&lt;/a&gt;
  </code></pre>
  <p>I don't know how can I get <code>$attach_id</code>.</p>