Don't reset parent when updating attachment. Props filosofo and michelwp. fixes #5010

git-svn-id: http://svn.automattic.com/wordpress/trunk@6155 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2007-09-22 16:30:40 +00:00
parent e56c1c2097
commit 72e74add8d
2 changed files with 5 additions and 1 deletions

View File

@ -201,6 +201,7 @@ addLoadEvent( function() {
h += "<td><textarea name='post_content' id='post_content'>" + this.currentImage.description + "</textarea></td>";
h += "</tr><tr id='buttons' class='submit'><td colspan='2'><input type='button' id='delete' name='delete' class='delete alignleft' value='" + this.deleteText + "' onclick='theFileList.deleteFile(" + id + ");' />";
h += "<input type='hidden' name='from_tab' value='" + this.tab + "' />";
h += "<input type='hidden' name='post_parent' value='" + parseInt(this.postID,10) + "' />";
h += "<input type='hidden' name='action' id='action-value' value='save' />";
h += "<input type='hidden' name='ID' value='" + id + "' />";
h += "<input type='hidden' name='_wpnonce' value='" + this.nonce + "' />";

View File

@ -1272,7 +1272,7 @@ function is_local_attachment($url) {
return false;
}
function wp_insert_attachment($object, $file = false, $post_parent = 0) {
function wp_insert_attachment($object, $file = false, $parent = 0) {
global $wpdb, $user_ID;
$defaults = array('post_status' => 'draft', 'post_type' => 'post', 'post_author' => $user_ID,
@ -1280,6 +1280,9 @@ function wp_insert_attachment($object, $file = false, $post_parent = 0) {
'menu_order' => 0, 'to_ping' => '', 'pinged' => '', 'post_password' => '');
$object = wp_parse_args($object, $defaults);
if ( !empty($parent) )
$object['post_parent'] = $parent;
$object = sanitize_post($object, 'db');
// export array as variables