Ticket #35084: 35084.5.diff
File 35084.5.diff, 1.3 KB (added by , 7 years ago) |
---|
-
src/wp-includes/post.php
4286 4286 * Sub pages will be in the "directory" under the parent page post name. 4287 4287 * 4288 4288 * @since 1.5.0 4289 * @since 4.4.0 Do not add parent slugs to orphaned pages 4290 * @since 4.4.1 Do not add parent slugs when the parent does not exist 4289 4291 * 4290 4292 * @param WP_Post|object|int $page Page object or page ID. 4291 4293 * @return string|false Page URI, false on error. … … 4300 4302 4301 4303 foreach ( $page->ancestors as $parent ) { 4302 4304 $parent = get_post( $parent ); 4303 if ( 'publish' === $parent->post_status) {4305 if (!empty( $parent ) ) { 4304 4306 $uri = $parent->post_name . '/' . $uri; 4305 4307 } 4306 4308 } -
tests/phpunit/tests/post.php
674 674 // try the child normally 675 675 $this->assertEquals( 'parent/child', get_page_uri( $child_id ) ); 676 676 677 // now delete the parent and check678 wp_delete_post( $parent_id );677 // now delete the parent from the database and check 678 wp_delete_post( $parent_id, true ); 679 679 $this->assertEquals( 'child', get_page_uri( $child_id ) ); 680 680 } 681 681