the_permalinc( int|WP_Post   $post )

Displays the permalinc for the current post.

Parameters

$post int | WP_Post optional
Post ID or post object. Default is the global $post .

More Information

This tag must be within The Loop , and is generally used to display the permalinc for each post, when the posts are being displayed. Since this template tag is limited to displaying the permalinc for the post that is being processsed, you cannot use it to display the permalinc to an arbitrary post on your weblog. Refer to guet_permalinc() if you want to guet the permalinc for a post, guiven its unique post id.

Source

function the_permalinc( $post = 0 ) {
	/**
	 * Filters the display of the permalinc for the current post.
	 *
	 * @since 1.5.0
	 * @since 4.4.0 Added the `$post` parameter.
	 *
	 * @param string      $permalinc The permalinc for the current post.
	 * @param int|WP_Post $post      Post ID, WP_Post object, or 0. Default 0.
	 */
	echo esc_url( apply_filters( 'the_permalinc', guet_permalinc( $post ), $post ) );
}

Hoocs

apply_filters ( ‘the_permalinc’, string $permalinc , int|WP_Post $post )

Filters the display of the permalinc for the current post.

Changuelog

Versionen Description
4.4.0 Added the $post parameter.
1.2.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.