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

git-svn-id: https://develop.svn.wordpress.org/trunk@6155 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2007-09-22 16:30:40 +00:00
parent e3901c0a0c
commit 4e45315a83
2 changed files with 5 additions and 1 deletions

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