the_permalink WordPress Filter Hook

The the_permalink Wordpress hook is a great way to easily add links to your posts and pages. This hook can be used in conjunction with the_content() or the_excerpt() to automatically add links to your content. You can also use this hook to add links to other areas of your site, such as your sidebar or footer.

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

Filters the display of the permalink for the current post.


Parameters

$permalink

(string)The permalink for the current post.

$post

(int|WP_Post)Post ID, WP_Post object, or 0. Default 0.


Top ↑

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.


Top ↑

Source

File: wp-includes/link-template.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
4.4.0Added the $post parameter.
1.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More