wppaste
WordPress

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:

  1. apply_filters( the_permalink )filterline 27 (+10 into the body)

    Filters the display of the permalink for the current post.

Uses · 3

Used by · 11

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.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

4.4.0
Added the $post parameter.from the docblock
1.2.0
Introduced.from the docblock

About this page

Parsed data
Generated from the wordpress-develop 6.8.8 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.