get_page_uri()
Build the URI path for a page.
Sub pages will be in the "directory" under the parent page post name.
Uses: get_post()
1 time — 0.000237 sec (fast) | 50000 times — 3.85 sec (fast)
Hooks from the function
Return
String|false
. Page URI, false on error.
Usage
get_page_uri( $page );
- $page(WP_Post|object|int)
- Page ID or WP_Post object.
Default: global $post
Examples
#1 Get the path to the current page
Suppose we have a page 1544
with label mypage
and it is a child of parent
. Then:
echo get_page_uri( 1544 ); // return: parent/mypage
Changelog
Since 1.5.0 | Introduced. |
Since 4.6.0 | The $page parameter was made optional. |