mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 09:37:42 +01:00
When deleting a page level up all children.
git-svn-id: http://svn.automattic.com/wordpress/trunk@2030 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
373276ee25
commit
4b9c67c876
@ -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