In `get_page_uri()`, do not add parent slugs to orphaned pages.

Adds unit test.

Props filosofo, MikeHansenMe, MikeHansenMe, chriscct7.
Fixes #15963. 

Built from https://develop.svn.wordpress.org/trunk@34001


git-svn-id: http://core.svn.wordpress.org/trunk@33970 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-09-10 16:54:24 +00:00
parent 49b8ccec79
commit 47409875ab
2 changed files with 5 additions and 2 deletions

View File

@ -4196,7 +4196,10 @@ function get_page_uri( $page ) {
$uri = $page->post_name; $uri = $page->post_name;
foreach ( $page->ancestors as $parent ) { foreach ( $page->ancestors as $parent ) {
$uri = get_post( $parent )->post_name . '/' . $uri; $parent = get_post( $parent );
if ( 'publish' === $parent->post_status ) {
$uri = $parent->post_name . '/' . $uri;
}
} }
return $uri; return $uri;

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.4-alpha-34000'; $wp_version = '4.4-alpha-34001';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.