title: Media upload not working fine with meta box in custom post type in Wordpress
body: <p>I have a <strong>custom post type</strong> with a <strong>custom image field</strong> created with <strong>meta boxes.</strong></p>
  
  <p>When I upload an image, the media upload window of WordPress is displayed correctly and I can  upload a new image. </p>
  
  <p>The problem is when I want to put an image of the media library because the images of the media library aren't loading.</p>
  
  <p>The <code>code</code> I use to load the media uploader is the next:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script type="text/javascript"&gt;
  jQuery(document).ready(function() {
    jQuery(".boton-imagen-caja").click(function() {
      formfieldID = jQuery(this).prev().attr("id");
      formfield = jQuery('#' + formfieldID).attr('name');
      tb_show('', 'media-upload.php?type=image&amp;TB_iframe=true');
      return false;
    });
    var restore_send_to_editor = window.send_to_editor;
    window.send_to_editor = function(html) {
      var imgurl = jQuery('img',html).attr('src');
      jQuery('#' + formfieldID).val(imgurl);
  
      tb_remove(); 
      window.send_to_editor = restore_send_to_editor;
    }
  });
  &lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><strong>I put a screenshot of the problem:</strong></p>
  
  <p><a href="http://i.stack.imgur.com/EXDyy.jpg" rel="nofollow">Screenshot of the media upload window where the media library images aren't loaded</a></p>