Images and files uploaded in PB are not attached to post

I’ve found that images uploaded in PB are not attached to the post. This may be possible with http://codex.wordpress.org/Function_Reference/media_sideload_image please consider using it.
We’re using the JS implementation of the uploader, so media_sideload_image won’t work (I’ve used that before). Good catch though. I’ll look into making that happen.

Hi,
this seems quite fundamental, please give it some love!
tnx

Alessandro

HI Alessandro, thanks for your feedback. We have looked into this in the past. We’ll have another look into it to see what we can figure out for a fix.

Best,
Billy

Hi Alessandro,

As I’ve mentioned, media_sideload_image isn’t going to work in this case since we’re using the JS uploader (wp.media). Documentation for the JS uploader is sparse or nonexistent, but the good news is I did stumble upon a blog post that had the answer for this. It has been added to the next release.

Justin

This is great news,
can you share a link to the article too?

Best,
Alessandro

Here you go… Using the WordPress 3.5 Media Uploader within plugins.

The trick is to set the post id using wp.media.model.settings.post.id = <POST_ID>.

The update is now available!

Justin

Awesome, thanks!
Alessandro