Make WordPress Core

Ticket #34234: 34234.diff

File 34234.diff, 2.5 KB (added by DrewAPicture, 11 years ago)
  • src/wp-includes/link-template.php

     
    1010 * Display the permalink for the current post.
    1111 *
    1212 * @since 1.2.0
    13  * @since 4.4.0 Added `$id` parameter.
     13 * @since 4.4.0 Added the `$post` parameter.
    1414 *
    15  * @param int|WP_Post $id Optional. Post ID or post object. Default current post.
     15 * @param int|WP_Post $post Optional. Post ID or post object. Default is the global `$post`.
    1616 */
    17 function the_permalink( $id = 0 ) {
     17function the_permalink( $post = 0 ) {
    1818        /**
    1919         * Filter the display of the permalink for the current post.
    2020         *
     
    2222         *
    2323         * @param string $permalink The permalink for the current post.
    2424         */
    25         echo esc_url( apply_filters( 'the_permalink', get_permalink( $id ) ) );
     25        echo esc_url( apply_filters( 'the_permalink', get_permalink( $post ) ) );
    2626}
    2727
    2828/**
     
    9494 *
    9595 * @see get_permalink()
    9696 *
    97  * @param int|WP_Post $id        Optional. Post ID or post object. Default current post.
     97 * @param int|WP_Post $post      Optional. Post ID or post object. Default is the global `$post`.
    9898 * @param bool        $leavename Optional. Whether to keep post name or page name. Default false.
     99 *
    99100 * @return string|false The permalink URL or false if post does not exist.
    100101 */
    101 function get_the_permalink( $id = 0, $leavename = false ) {
    102         return get_permalink( $id, $leavename );
     102function get_the_permalink( $post = 0, $leavename = false ) {
     103        return get_permalink( $post, $leavename );
    103104}
    104105
    105106/**
     
    107108 *
    108109 * @since 1.0.0
    109110 *
    110  * @param int|WP_Post $id        Optional. Post ID or post object. Default current post.
     111 * @param int|WP_Post $post      Optional. Post ID or post object. Default is the global `$post`.
    111112 * @param bool        $leavename Optional. Whether to keep post name or page name. Default false.
    112113 * @return string|false The permalink URL or false if post does not exist.
    113114 */
    114 function get_permalink( $id = 0, $leavename = false ) {
     115function get_permalink( $post = 0, $leavename = false ) {
    115116        $rewritecode = array(
    116117                '%year%',
    117118                '%monthnum%',
     
    126127                $leavename? '' : '%pagename%',
    127128        );
    128129
    129         if ( is_object($id) && isset($id->filter) && 'sample' == $id->filter ) {
    130                 $post = $id;
     130        if ( is_object( $post ) && isset( $post->filter ) && 'sample' == $post->filter ) {
    131131                $sample = true;
    132132        } else {
    133                 $post = get_post($id);
     133                $post = get_post( $post );
    134134                $sample = false;
    135135        }
    136136