WordPress.org

Make WordPress Core

Changeset 34982


Ignore:
Timestamp:
10/09/2015 04:33:16 AM (4 years ago)
Author:
SergeyBiryukov
Message:

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

Props johnjamesjacoby, chriscct7.
Fixes #23882.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/link-template.php

    r34717 r34982  
    1111 *
    1212 * @since 1.2.0
    13  */
    14 function the_permalink() {
     13 * @since 4.4.0 Added `$id` parameter.
     14 *
     15 * @param int|WP_Post $id Optional. Post ID or post object. Default current post.
     16 */
     17function the_permalink( $id = 0 ) {
    1518    /**
    1619     * Filter the display of the permalink for the current post.
     
    2023     * @param string $permalink The permalink for the current post.
    2124     */
    22     echo esc_url( apply_filters( 'the_permalink', get_permalink() ) );
     25    echo esc_url( apply_filters( 'the_permalink', get_permalink( $id ) ) );
    2326}
    2427
     
    9295 * @see get_permalink()
    9396 *
    94  * @param int|WP_Post $id        Optional. Post ID or post object. Default is the current post.
     97 * @param int|WP_Post $id        Optional. Post ID or post object. Default current post.
    9598 * @param bool        $leavename Optional. Whether to keep post name or page name. Default false.
    9699 * @return string|false The permalink URL or false if post does not exist.
Note: See TracChangeset for help on using the changeset viewer.