Add `$id` parameter to `the_permalink()`, for consistency with `get_permalink()`.

Props johnjamesjacoby, chriscct7.
Fixes #23882.
Built from https://develop.svn.wordpress.org/trunk@34982


git-svn-id: http://core.svn.wordpress.org/trunk@34947 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2015-10-09 04:34:24 +00:00
parent 4852cbf14b
commit 3012b862af
2 changed files with 7 additions and 4 deletions

View File

@ -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.
*/

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.4-alpha-34981';
$wp_version = '4.4-alpha-34982';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.