the_permalink( int|WP_Post $post = 0 )
- Since
- 1.2.0, 4.4.0
- Source
wp-includes/link-template.php:17
Displays the permalink for the current post.
Parameters
$postint|WP_Postoptional- Post ID or post object. Default is the global
$post.Default:0
Hooks fired · 1
One hook fires while the_permalink() runs, in this order:
- apply_filters( the_permalink )filterline 27 (+10 into the body)
Filters the display of the permalink for the current post.
Uses · 3
- esc_url()Checks and cleans a URL.
- apply_filters()Calls the callback functions that have been added to a filter hook.
- get_permalink()Retrieves the full permalink for the current post or post ID.
Used by · 11
- Twenty_Fourteen_Ephemera_Widget::widget()Outputs the HTML for this widget.
- WP_Widget_Recent_Posts::widget()Outputs the content for the current Recent Posts widget instance.
- permalink_link()Print the permalink of the current post in the loop.
- print_embed_sharing_dialog()Prints the necessary markup for the embed sharing dialog.
- trackback_rdf()Generates and displays the RDF for the trackback information of current post.
- twenty_twenty_one_post_thumbnail()Displays an optional post thumbnail.
- twentyfifteen_post_thumbnail()Displays an optional post thumbnail.
- twentyfourteen_post_thumbnail()Displays an optional post thumbnail.
- twentynineteen_post_thumbnail()Displays an optional post thumbnail.
- twentysixteen_post_thumbnail()Displays an optional post thumbnail.
- twentytwenty_get_post_meta()Retrieves the post meta.
Source
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 ) );}History
Introduced in 1.2.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
4.4.0
Added the
$post parameter.from the docblock1.2.0
Introduced.from the docblock
About this page
- Parsed data
- Generated from the wordpress-develop 7.0.4 tag, from
src/wp-includes/link-template.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.