Displays the URL for the permalink to the post currently being processed in The Loop. This tag must be within The Loop, and is generally used to display the permalink for each post, when the posts are being displayed. Since this template tag is limited to displaying the permalink for the post that is being processed, you cannot use it to display the permalink to an arbitrary post on your weblog. Refer to get_permalink() if you want to get the permalink for a post, given its unique post id.

the_permalink() 描述


 <?php the_permalink(); ?> 

the_permalink() 用法


This tag has no parameters.

the_permalink() 参数


Display Post URL as Text

Displays the URL to the post, without creating a link:

As Link With Text

You can use whatever text you like as the link text, in this case, "permalink".

Used as Link With Title Tag

Creates a link for the permalink, with the post's title as the link text. This is a common way to put the post's title.

the_permalink() 示例


the_permalink() 历史


the_permalink() 函数的代码位于 wp-includes/link-template.php.

the_permalink() 源文件