change post_parent on orphaned attachments. props ryanscheuermann. fixes #2681
git-svn-id: http://svn.automattic.com/wordpress/trunk@4601 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5dbc09631b
commit
84ec7763be
|
@ -410,6 +410,8 @@ function wp_delete_post($postid = 0) {
|
|||
if ( 'page' == $post->post_type )
|
||||
$wpdb->query("UPDATE $wpdb->posts SET post_parent = $post->post_parent WHERE post_parent = $postid AND post_type = 'page'");
|
||||
|
||||
$wpdb->query("UPDATE $wpdb->posts SET post_parent = $post->post_parent WHERE post_parent = $postid AND post_type = 'attachment'");
|
||||
|
||||
$wpdb->query("DELETE FROM $wpdb->posts WHERE ID = $postid");
|
||||
|
||||
$wpdb->query("DELETE FROM $wpdb->comments WHERE comment_post_ID = $postid");
|
||||
|
|
Loading…
Reference in New Issue