When deleting a page level up all children.
git-svn-id: https://develop.svn.wordpress.org/trunk@2030 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
c136a2ad21
commit
0717e39156
@ -194,11 +194,15 @@ function wp_set_post_cats($blogid = '1', $post_ID = 0, $post_categories = array(
|
||||
|
||||
function wp_delete_post($postid = 0) {
|
||||
global $wpdb;
|
||||
$postid = (int) $postid;
|
||||
|
||||
$result = $wpdb->query("DELETE FROM $wpdb->posts WHERE ID = $postid");
|
||||
if ( !$post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID = $postid") )
|
||||
return $post;
|
||||
|
||||
if (!$result)
|
||||
return $result;
|
||||
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("DELETE FROM $wpdb->posts WHERE ID = $postid");
|
||||
|
||||
$wpdb->query("DELETE FROM $wpdb->comments WHERE comment_post_ID = $postid");
|
||||
|
||||
@ -206,7 +210,7 @@ function wp_delete_post($postid = 0) {
|
||||
|
||||
$wpdb->query("DELETE FROM $wpdb->postmeta WHERE post_id = $postid");
|
||||
|
||||
return $result;
|
||||
return $post;
|
||||
}
|
||||
|
||||
/**** /DB Functions ****/
|
||||
|
Loading…
Reference in New Issue
Block a user