apply_filters( ‘the_permalink’, string $permalink, int|WP_Post $post )

Filters the display of the permalink for the current post.

Parameters

$permalinkstring
The permalink for the current post.
$postint|WP_Post
Post ID, WP_Post object, or 0. Default 0.

More Information

the_permalink is a filter applied to the permalink URL for a post prior to printing by the function the_permalink().

Note: The output of the functions get_permalink() or get_the_permalink() is not filtered.

Source

echo esc_url( apply_filters( 'the_permalink', get_permalink( $post ), $post ) );

Changelog

VersionDescription
4.4.0Added the $post parameter.
1.5.0Introduced.

User Contributed Notes

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