wppaste
WordPress

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

Since
1.5.0, 4.4.0
Filters the display of the permalink for the current post.

Compatibility

WordPress
since 4.4.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Parameters

$postint|WP_Post
Post ID, WP_Post object, or 0. Default 0.

Where this hook fires · 6

  • wp-content/themes/twentyeleven/functions.php:692twentyeleven_get_first_url()
  • wp-content/themes/twentyfifteen/inc/template-tags.php:250twentyfifteen_get_link_url()
  • wp-content/themes/twentythirteen/functions.php:743twentythirteen_get_link_url()
  • wp-includes/comment-template.php:2625comment_form()
  • wp-includes/comment-template.php:2636comment_form()
  • wp-includes/link-template.php:27the_permalink()

Source code

	 * @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 ) );} /** * Retrieves a trailing-slashed string if the site is set for adding trailing slashes. * * Conditionally adds a trailing slash if the permalink structure has a trailing

Changelog

Introduced in 1.5.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.5.0
Introduced.from the docblock

About this page

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