From 90f3849d62b626ed06ad85d2ec19d7a54feebc9c Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 9 Oct 2015 04:33:16 +0000 Subject: [PATCH] Add `$id` parameter to `the_permalink()`, for consistency with `get_permalink()`. Props johnjamesjacoby, chriscct7. Fixes #23882. git-svn-id: https://develop.svn.wordpress.org/trunk@34982 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/link-template.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/wp-includes/link-template.php b/src/wp-includes/link-template.php index 8573e5322b..ebb1ca67fe 100644 --- a/src/wp-includes/link-template.php +++ b/src/wp-includes/link-template.php @@ -10,8 +10,11 @@ * Display the permalink for the current post. * * @since 1.2.0 + * @since 4.4.0 Added `$id` parameter. + * + * @param int|WP_Post $id Optional. Post ID or post object. Default current post. */ -function the_permalink() { +function the_permalink( $id = 0 ) { /** * Filter the display of the permalink for the current post. * @@ -19,7 +22,7 @@ function the_permalink() { * * @param string $permalink The permalink for the current post. */ - echo esc_url( apply_filters( 'the_permalink', get_permalink() ) ); + echo esc_url( apply_filters( 'the_permalink', get_permalink( $id ) ) ); } /** @@ -91,7 +94,7 @@ function permalink_anchor( $mode = 'id' ) { * * @see get_permalink() * - * @param int|WP_Post $id Optional. Post ID or post object. Default is the current post. + * @param int|WP_Post $id Optional. Post ID or post object. Default current post. * @param bool $leavename Optional. Whether to keep post name or page name. Default false. * @return string|false The permalink URL or false if post does not exist. */