From b246624b4f5ef031809e4b88dc9586bea84497e9 Mon Sep 17 00:00:00 2001 From: Daryl Koopersmith Date: Mon, 22 Oct 2012 17:40:06 +0000 Subject: [PATCH] Correctly assign post_parent to attachments uploaded in the new media modal. fixes #22085, see #21390. git-svn-id: https://develop.svn.wordpress.org/trunk@22267 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/js/media-views.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/wp-includes/js/media-views.js b/wp-includes/js/media-views.js index b8c3f66551..a16b6f8ad4 100644 --- a/wp-includes/js/media-views.js +++ b/wp-includes/js/media-views.js @@ -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 ) ); },