diff --git src/wp-includes/post.php src/wp-includes/post.php
index cc8e843..72ef164 100644
|
|
|
function _page_traverse_name( $page_id, &$children, &$result ){ |
| 4291 | 4291 | * @return string|false Page URI, false on error. |
| 4292 | 4292 | */ |
| 4293 | 4293 | function get_page_uri( $page ) { |
| 4294 | | $page = get_post( $page ); |
| | 4294 | if ( ! $page instanceof WP_Post ) { |
| | 4295 | $page = get_post( $page ); |
| | 4296 | } |
| 4295 | 4297 | |
| 4296 | 4298 | if ( ! $page ) |
| 4297 | 4299 | return false; |
diff --git tests/phpunit/tests/admin/includesPost.php tests/phpunit/tests/admin/includesPost.php
index c9e92f0..89803cc 100644
|
|
|
class Tests_Admin_Includes_Post extends WP_UnitTestCase { |
| 454 | 454 | $this->assertEquals( '30', $found[1] ); |
| 455 | 455 | } |
| 456 | 456 | |
| | 457 | /** |
| | 458 | * @ticket 35368 |
| | 459 | */ |
| | 460 | public function test_get_sample_permalink_should_respect_hierarchy_of_draft_pages() { |
| | 461 | $this->set_permalink_structure( '/%postname%/' ); |
| | 462 | |
| | 463 | $parent = self::factory()->post->create( array( |
| | 464 | 'post_type' => 'page', |
| | 465 | 'post_title' => 'Parent Page', |
| | 466 | ) ); |
| | 467 | |
| | 468 | $child = self::factory()->post->create( array( |
| | 469 | 'post_type' => 'page', |
| | 470 | 'post_title' => 'Child Page', |
| | 471 | 'post_parent' => $parent, |
| | 472 | 'post_status' => 'draft', |
| | 473 | ) ); |
| | 474 | |
| | 475 | $actual = get_sample_permalink( $child ); |
| | 476 | $this->assertSame( home_url() . '/parent-page/%pagename%/', $actual[0] ); |
| | 477 | $this->assertSame( 'child-page', $actual[1] ); |
| | 478 | } |
| | 479 | |
| 457 | 480 | public function test_post_exists_should_match_title() { |
| 458 | 481 | $p = self::factory()->post->create( array( |
| 459 | 482 | 'post_title' => 'Foo Bar', |