mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-05 18:32:23 +01:00
change post_parent on orphaned attachments. props ryanscheuermann. fixes #2681
git-svn-id: http://svn.automattic.com/wordpress/branches/2.0@4602 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4c99f09227
commit
1a3f75b48a
@ -552,6 +552,8 @@ function wp_delete_post($postid = 0) {
|
||||
if ( 'static' == $post->post_status )
|
||||
$wpdb->query("UPDATE $wpdb->posts SET post_parent = $post->post_parent WHERE post_parent = $postid AND post_status = 'static'");
|
||||
|
||||
$wpdb->query("UPDATE $wpdb->posts SET post_parent = $post->post_parent WHERE post_parent = $postid AND post_status = '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
Block a user