From d7640fc5d256d754a5ae5c4cfc74713771a8eed4 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Thu, 27 Dec 2012 15:26:05 +0000 Subject: [PATCH] Always call get_post() in get_page_uri() to ensure we have a WP_Post object, which lazy-loads the ancestors this function requires. props dd32 fixes #22883 Unit tests: [1175/tests] git-svn-id: https://develop.svn.wordpress.org/trunk@23208 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/post.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/post.php b/wp-includes/post.php index 9562e07e33..f1b1bf96bd 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -3594,8 +3594,8 @@ function _page_traverse_name( $page_id, &$children, &$result ){ * @return string Page URI. */ function get_page_uri($page) { - if ( ! is_object($page) ) - $page = get_post( $page ); + $page = get_post( $page ); + $uri = $page->post_name; foreach ( $page->ancestors as $parent ) {