Ticket #34234: 34234.diff
| File 34234.diff, 2.5 KB (added by , 11 years ago) |
|---|
-
src/wp-includes/link-template.php
10 10 * Display the permalink for the current post. 11 11 * 12 12 * @since 1.2.0 13 * @since 4.4.0 Added `$id` parameter.13 * @since 4.4.0 Added the `$post` parameter. 14 14 * 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`. 16 16 */ 17 function the_permalink( $ id= 0 ) {17 function the_permalink( $post = 0 ) { 18 18 /** 19 19 * Filter the display of the permalink for the current post. 20 20 * … … 22 22 * 23 23 * @param string $permalink The permalink for the current post. 24 24 */ 25 echo esc_url( apply_filters( 'the_permalink', get_permalink( $ id) ) );25 echo esc_url( apply_filters( 'the_permalink', get_permalink( $post ) ) ); 26 26 } 27 27 28 28 /** … … 94 94 * 95 95 * @see get_permalink() 96 96 * 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`. 98 98 * @param bool $leavename Optional. Whether to keep post name or page name. Default false. 99 * 99 100 * @return string|false The permalink URL or false if post does not exist. 100 101 */ 101 function get_the_permalink( $ id= 0, $leavename = false ) {102 return get_permalink( $ id, $leavename );102 function get_the_permalink( $post = 0, $leavename = false ) { 103 return get_permalink( $post, $leavename ); 103 104 } 104 105 105 106 /** … … 107 108 * 108 109 * @since 1.0.0 109 110 * 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`. 111 112 * @param bool $leavename Optional. Whether to keep post name or page name. Default false. 112 113 * @return string|false The permalink URL or false if post does not exist. 113 114 */ 114 function get_permalink( $ id= 0, $leavename = false ) {115 function get_permalink( $post = 0, $leavename = false ) { 115 116 $rewritecode = array( 116 117 '%year%', 117 118 '%monthnum%', … … 126 127 $leavename? '' : '%pagename%', 127 128 ); 128 129 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 ) { 131 131 $sample = true; 132 132 } else { 133 $post = get_post( $id);133 $post = get_post( $post ); 134 134 $sample = false; 135 135 } 136 136