diff --git a/wp-includes/post.php b/wp-includes/post.php index f13d34b823..10ee07b20a 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -2405,8 +2405,9 @@ function wp_delete_post( $postid = 0, $force_delete = false ) { // Point children of this page to its parent, also clean the cache of affected children. $children_query = $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE post_parent = %d AND post_type = %s", $postid, $post->post_type ); $children = $wpdb->get_results( $children_query ); - - $wpdb->update( $wpdb->posts, $parent_data, $parent_where + array( 'post_type' => $post->post_type ) ); + if ( $children ) { + $wpdb->update( $wpdb->posts, $parent_data, $parent_where + array( 'post_type' => $post->post_type ) ); + } } // Do raw query. wp_get_post_revisions() is filtered. diff --git a/wp-includes/version.php b/wp-includes/version.php index 05eb322648..8f9845fdd7 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.5-alpha-35816'; +$wp_version = '4.5-alpha-35817'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.