Correctly assign post_parent to attachments uploaded in the new media modal. fixes #22085, see #21390.

git-svn-id: http://core.svn.wordpress.org/trunk@22267 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Daryl Koopersmith 2012-10-22 17:40:06 +00:00
parent 7b62c8753d
commit 4188c373fd
1 changed files with 9 additions and 2 deletions

View File

@ -672,16 +672,23 @@
},
maybeInitUploader: function() {
var workspace = this;
var workspace = this,
params = {},
$id;
// If the uploader already exists or the body isn't in the DOM, bail.
if ( this.uploader || ! this.$el.closest('body').length )
return;
$id = $('#post_ID');
if ( $id.length )
params.post_id = $id.val();
this.uploader = new wp.Uploader( _.extend({
container: this.$el,
dropzone: this.$el,
browser: this.$('.upload-attachments a')
browser: this.$('.upload-attachments a'),
params: params
}, this.options.uploader ) );
},