title: Wordpress get attachment of post doesn't work
body: <p>I'm trying to retrieve all the attachment of a specific post, but it doesn't work for the moment. Here is the code : </p>
  
  <pre><code>    $args = array(
          'post_type' =&gt; 'attachment',
          'posts_per_page' =&gt; -1,
          'post_parent' =&gt; $id
      );
      $attachments = get_posts($args);
  </code></pre>
  
  <p>Where Id is the id of my post. I've tried also with new WP_Query() but it didn't worked neither. Both ways return an empty result. </p>
  
  <p>Does anyone have an idea what I'm doing wrong here ? </p>
  
  <p>Thanks</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Ok, I think I know what's going wront. 
  When using this arguments for the get_posts function, it will return the images uploaded through the "Add a media" button in the specific post. </p>
  
  <p>So basically, let's say that on my first post, I've uploaded all the images I would need for all my future post. If I apply the request on the first post, I will retrieve all the images, even the one that I don't use in this post. 
  If I apply this function to another post, because I didn't uploaded any file in this post, the function will retrieve an empty array. </p>
  
  <p>Does anyone have an idea how I can retrieve all the images used in a specific post ? So not only uploaded, but really integrated into the post or added to a custom field ? </p>
  
  <p>Thanks</p>