mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Posts: Allow get_page_uri() to be called without a $page argument.
`get_page_uri()` can now be called without an argument, which will return the page URI for the current post in the loop. Props pollett. Fixes #26284. git-svn-id: https://develop.svn.wordpress.org/trunk@37345 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -4428,11 +4428,12 @@ function _page_traverse_name( $page_id, &$children, &$result ){
|
||||
* Sub pages will be in the "directory" under the parent page post name.
|
||||
*
|
||||
* @since 1.5.0
|
||||
* @since 4.6.0 The $page parameter is optional.
|
||||
*
|
||||
* @param WP_Post|object|int $page Page object or page ID.
|
||||
* @param WP_Post|object|int $page Optional. Page ID or WP_Post object. Default is global $post.
|
||||
* @return string|false Page URI, false on error.
|
||||
*/
|
||||
function get_page_uri( $page ) {
|
||||
function get_page_uri( $page = 0 ) {
|
||||
if ( ! $page instanceof WP_Post ) {
|
||||
$page = get_post( $page );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user