Changeset 35817
- Timestamp:
- 12/07/2015 05:46:35 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post.php
r35800 r35817 2406 2406 $children_query = $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE post_parent = %d AND post_type = %s", $postid, $post->post_type ); 2407 2407 $children = $wpdb->get_results( $children_query ); 2408 2409 $wpdb->update( $wpdb->posts, $parent_data, $parent_where + array( 'post_type' => $post->post_type ) ); 2408 if ( $children ) { 2409 $wpdb->update( $wpdb->posts, $parent_data, $parent_where + array( 'post_type' => $post->post_type ) ); 2410 } 2410 2411 } 2411 2412 -
trunk/tests/phpunit/tests/post.php
r35800 r35817 1254 1254 $this->assertEquals($post['post_date_gmt'], $out->post_date_gmt); 1255 1255 } 1256 1257 function test_wp_delete_post_reassign_hierarchical_post_type() { 1258 $grandparent_page_id = self::factory()->post->create( array( 'post_type' => 'page' ) ); 1259 $parent_page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_parent' => $grandparent_page_id ) ); 1260 $page_id = self::factory()->post->create( array( 'post_type' => 'page', 'post_parent' => $parent_page_id ) ); 1261 $this->assertEquals( $parent_page_id, get_post( $page_id )->post_parent ); 1262 wp_delete_post( $parent_page_id, true ); 1263 $this->assertEquals( $grandparent_page_id, get_post( $page_id )->post_parent ); 1264 wp_delete_post( $grandparent_page_id, true ); 1265 $this->assertEquals( 0, get_post( $page_id )->post_parent ); 1266 } 1267 1256 1268 }
Note: See TracChangeset
for help on using the changeset viewer.