title: Get images used in, but not attached to page?
body: <p>I want to get all of the images used in a page. This is the code I'm using:</p>
  
  <pre><code>function get_page_images($id) {
      $photos = get_children( array(
          'post_parent' =&gt; $id,
          'post_status' =&gt; 'inherit',
          'post_type' =&gt; 'attachment',
          'post_mime_type' =&gt; 'image',
          'order' =&gt; 'ASC',
          'orderby' =&gt; 'menu_order ID') );
  
      $results = array();
  
      if ($photos) {
          foreach ($photos as $photo) {
              // get the correct image html for the selected size
              $results[] = wp_get_attachment_image($photo-&gt;ID, $size);
          }
      }
  
      return $results;
  }
  </code></pre>
  
  <p>This only gets images uploaded specifically for this page, if I have reused an image that was already previously uploaded for a different page/post, those aren't retrieved (as they are attached to the post they were uploaded to, but not any posts they are reused in). Does anyone know a way to get <strong>all</strong> the images used in a page/post?</p>