the_permalink()WP 1.2.0

Displays link (URL) to the post that is currently being processed in the Loop.

This template tag can be used only inside the Loop of WordPress.

1 time — 0.002275 sec (very slow) | 50000 times — 5.62 sec (fast) | PHP 7.1.2, WP 4.7.3
Hooks from the function


null. Nothing (null).


the_permalink( $post );
Post ID or post object.
Default: global $post



#1 Let's display a link to the post in the form of simple text, not html link

Address of this post: <?php the_permalink(); ?>

#2 Let's display html link to the current post

The link text will be: "permanent link":

<a href="<?php the_permalink(); ?>">permanent link</a>

#3 Display a link to the current post

The text of the link will be the title of the post.

This is the standard way to output a link to a post within a Loop:

<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a>


Since 1.2.0 Introduced.
Since 4.4.0 Added the $post parameter.

the_permalink() code WP 6.5.2

function the_permalink( $post = 0 ) {
	 * Filters the display of the permalink for the current post.
	 * @since 1.5.0
	 * @since 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 ) );