Ticket #9471: _relocate_children.diff
File _relocate_children.diff, 1.2 KB (added by , 16 years ago) |
---|
-
wp-includes/post.php
2555 2555 2556 2556 clean_post_cache($post_ID); 2557 2557 2558 if ( isset($post_parent) && $post_parent < 0 ) 2559 add_post_meta($post_ID, '_wp_attachment_temp_parent', $post_parent, true); 2560 2558 2561 if ( $update) { 2559 2562 do_action('edit_attachment', $post_ID); 2560 2563 } else { -
wp-admin/includes/post.php
759 759 global $wpdb; 760 760 $old_ID = (int) $old_ID; 761 761 $new_ID = (int) $new_ID; 762 return $wpdb->update($wpdb->posts, array('post_parent' => $new_ID), array('post_parent' => $old_ID) ); 762 763 $children = $wpdb->get_col(" 764 SELECT post_id 765 FROM $wpdb->postmeta 766 WHERE meta_key = '_wp_attachment_temp_parent' 767 AND meta_value = $old_ID 768 "); 769 770 foreach ( $children as $child_id ) { 771 $wpdb->update($wpdb->posts, array('post_parent' => $new_ID), array('ID' => $child_id) ); 772 delete_post_meta($child_id, '_wp_attachment_temp_parent'); 773 } 763 774 } 764 775 765 776 /**