diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php index ba6d5bab60..be8e62e107 100644 --- a/wp-admin/includes/post.php +++ b/wp-admin/includes/post.php @@ -1036,7 +1036,7 @@ function get_sample_permalink($id, $title = null, $name = null) { // Handle page hierarchy if ( $ptype->hierarchical ) { - $uri = get_page_uri($post->ID); + $uri = get_page_uri($post); $uri = untrailingslashit($uri); $uri = strrev( stristr( strrev( $uri ), '/' ) ); $uri = untrailingslashit($uri); diff --git a/wp-includes/post.php b/wp-includes/post.php index 2926eca864..09693047c5 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -2908,11 +2908,12 @@ function _page_traverse_name( $page_id, &$children, &$result ){ * * @since 1.5.0 * - * @param int $page_id Page ID. + * @param mixed $page Page object or page ID. * @return string Page URI. */ -function get_page_uri($page_id) { - $page = get_page($page_id); +function get_page_uri($page) { + if ( ! is_object($page) ) + $page = get_page($page); $uri = $page->post_name; // A page cannot be it's own parent.