title: Limit wordpress gallery to post only
body: <p>I've got a front-end uploader that allows users to upload images to a post. When they click the upload button that opens up the gallery they are able to see every image in the galllery, not just the ones tied to that specific post. I'd like to change that. I'd like when a user is in a post trying to upload an image, they can not see images tied to another post. </p>
  
  <p>I've googled all I can think of and can't find a solution. 
  Here's my code:</p>
  
  <pre><code>var image_custom_uploader_2;
  var $thisItem = '';
  
  jQuery(document).on('click', '.avatar-upload-image', function(e) {
      e.preventDefault();
  
      $thisItem = jQuery(this);
  
      //If the uploader object has already been created, reopen the dialog
      if (image_custom_uploader_2) {
          image_custom_uploader_2.open();
          return;
      }
  
      //Extend the wp.media object
      image_custom_uploader_2 = wp.media.frames.file_frame = wp.media({
          title: 'Choose Image',
          button: {
              text: 'Choose Image'
          },
          multiple: false
      });
      console.log(image_custom_uploader_2);
  
      //When a file is selected, grab the URL and set it as the text field's value
      image_custom_uploader_2.on('select', function() {
          attachment = image_custom_uploader_2.state().get('selection').first().toJSON();
          var url = '';
          url = attachment['url'];
          var attachId = '';
          attachId = attachment['id'];
          $thisItem.parent().find('.listing-upload-gallery-image-data-url').val(url);
          $thisItem.parent().find('.listing-upload-gallery-image-data-id').val(attachId);
          $thisItem.parent().find(".gallery-image-holder").css("background-image", "url(" + url + ")");
          $thisItem.parent().find(".avatar-upload-image").css("display", "none");
          $thisItem.parent().find(".avatar-delete-image").css("display", "inline-block");
      });
  
      //Open the uploader dialog
      image_custom_uploader_2.open();
  });
  
  jQuery(document).on('click', '.avatar-delete-image', function(e) {
      jQuery(this).parent().find('.listing-upload-gallery-image-data-url').val('');
      jQuery(this).parent().find('.listing-upload-gallery-image-data-id').val('');
      jQuery(this).parent().find(".gallery-image-holder").css("background-image", "none");
      jQuery(this).parent().find(".avatar-upload-image").css("display", "inline-block");
      jQuery(this).css("display", "none");
  });
  </code></pre>
  
  <p>I have a feeling I need to somehow incorporate one of the following:</p>
  
  <pre><code>uploadedTo : 
  post_parent :
  </code></pre>
  
  <p>but I'm not sure how to apply a post ID to them when this would be on a brand new, unsaved post</p>
  
  <p>EDIT:<br/>
  <code>uploadedTo : wp.media.view.settings.post.id</code><br/>
  <code>uploadedTo : $post-id</code><br/>
  Still allow all the other media items to be seen on the post's media library</p>