the_permalink( int|WP_Post $post )
Displays the permalink for the current post.
Parameters
- $post
-
(Optional) Post ID or post object. Default is the global
$post
.
Source
File: wp-includes/link-template.php
function the_permalink( $post = 0 ) {
/**
* Filters the display of the permalink for the current post.
*
* @since WP-1.5.0
* @since WP-4.4.0 Added the `$post` parameter.
*
* @param string $permalink The permalink for the current post.
* @param int|WP_Post $post Post ID, WP_Post object, or 0. Default 0.
*/
echo esc_url( apply_filters( 'the_permalink', get_permalink( $post ), $post ) );
}
Changelog
Version | Description |
---|---|
4.4.0 | Added the $post parameter. |
1.2.0 | Introduced. |