Add inline documentation for get_page_by_path().

Fixes #34964.


git-svn-id: https://develop.svn.wordpress.org/trunk@35861 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Eric Andrew Lewis 2015-12-11 03:49:40 +00:00
parent 26e7188154
commit f1b07f779f

View File

@ -4122,6 +4122,11 @@ function get_page_by_path( $page_path, $output = OBJECT, $post_type = 'page' ) {
if ( $page->post_name == $revparts[0] ) { if ( $page->post_name == $revparts[0] ) {
$count = 0; $count = 0;
$p = $page; $p = $page;
/*
* Loop through the given path parts from right to left,
* ensuring each matches the post ancestry.
*/
while ( $p->post_parent != 0 && isset( $pages[ $p->post_parent ] ) ) { while ( $p->post_parent != 0 && isset( $pages[ $p->post_parent ] ) ) {
$count++; $count++;
$parent = $pages[ $p->post_parent ]; $parent = $pages[ $p->post_parent ];