In the past when using thickbox to upload images, an image could be uploaded without having the post ID ‘attached’ to it by simply using the code below :
jQuery('.upload_slider_button').click(function() {
tb_show('', 'media-upload.php?post_id=&type=image&TB_iframe=true&referer=matrix-settings');
return false;
});
However, how can I achieve the same thing using the new Media Uploader which was introduced since WP3.5? I have spent the whole day searching in the internet but there isn’t much resources available on this new media uploader. Most of it are focused on utilizing it in theme options / plugins.
Or perhaps there are other ways of uploading an image without having the post ID ‘attached’ to it and yet not using any plugins?
Thanks a lot for helping.
Well, I have finally figured it out. Using Mike’s example here, I just need to put this code
wp.media.model.settings.post.id = 0
at this place :This will cause the image to be uploaded as ‘Unattached’. Hope this helps someone facing this problem in the future.