WordPress get fixed link tag: get_ permalink

WordPress template tag get_ Permalink is used to obtain the fixed link of the article, that is, the pseudo static link. It needs to be used in the main loop of the loop. If it is used outside the main loop, it needs to pass the article ID or the object containing the article information.

get_permalink( int|WP_Post $post = 0, bool $leavename = false )

Function parameters


Integer or object. The default value is the ID of the current article

Provide an article ID or an object containing article information, and output the fixed link of the article.


Boolean, default: false

If true, the% postname% in the fixed link settings will be output as is instead of the article name.

Examples of function usage

<?php echo '<a href="' . get_permalink() . '">' . get_the_title() . '</a>'; ?>

Extended reading

get_ The permalink() function is located in: WP includes / link- template.php

Related Tags:

  • permalink_ anchor()
  • the_ permalink()
  • post_ permalink()
  • permalink_ single_ rss()
Related Article
WordPress comment date tag: comment_date

WordPress template tags comment_ Date is used to output the date of a comment, usually in a custom comment template. Read more

WordPress comment summary tag: comment_excerpt

WordPress template tags comment_ Excerpt is used to output the summary of comments. The default output is 20 characters. It Read more

WordPress comment time tag: comment_time

WordPress template tags comment_ Time is used to output the publishing time of the current comment, which is the same Read more

WordPress RSS format comment author name tag: comment_author_rss

WordPress template tags comment_ author_ RSS is used to output the comment author name in RSS format, which has no Read more

Leave a Reply

Your email address will not be published. Required fields are marked *

To prove you're a person (not a spam script), type the security word shown in the picture.
Anti-spam image