Title: get_the_permalink
Published: April 25, 2014
Last modified: February 24, 2026

---

# get_the_permalink( int|WP_Post $post, bool $leavename = false ): string|false

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/get_the_permalink/?output_format=md#description)
    - [See also](https://developer.wordpress.org/reference/functions/get_the_permalink/?output_format=md#see-also)
 * [Parameters](https://developer.wordpress.org/reference/functions/get_the_permalink/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/get_the_permalink/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/get_the_permalink/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/get_the_permalink/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/get_the_permalink/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/functions/get_the_permalink/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/functions/get_the_permalink/?output_format=md#wp--skip-link--target)

Retrieves the full permalink for the current post or post ID.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/get_the_permalink/?output_format=md#description)󠁿

This function is an alias for [get_permalink()](https://developer.wordpress.org/reference/functions/get_permalink/).

### 󠀁[See also](https://developer.wordpress.org/reference/functions/get_the_permalink/?output_format=md#see-also)󠁿

 * [get_permalink()](https://developer.wordpress.org/reference/functions/get_permalink/)

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/get_the_permalink/?output_format=md#parameters)󠁿

 `$post`int|[WP_Post](https://developer.wordpress.org/reference/classes/wp_post/)
optional

Post ID or post object. Default is the global `$post`.

`$leavename`booloptional

Whether to keep post name or page name.

Default:`false`

## 󠀁[Return](https://developer.wordpress.org/reference/functions/get_the_permalink/?output_format=md#return)󠁿

 string|false The permalink URL. False if the post does not exist.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/get_the_permalink/?output_format=md#source)󠁿

    ```php
    function get_the_permalink( $post = 0, $leavename = false ) {
    	return get_permalink( $post, $leavename );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/link-template.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/link-template.php#L157)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/link-template.php#L157-L159)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/get_the_permalink/?output_format=md#related)󠁿

| Uses | Description | 
| [get_permalink()](https://developer.wordpress.org/reference/functions/get_permalink/)`wp-includes/link-template.php` |

Retrieves the full permalink for the current post or post ID.

  |

| Used by | Description | 
| [_wp_dashboard_recent_comments_row()](https://developer.wordpress.org/reference/functions/_wp_dashboard_recent_comments_row/)`wp-admin/includes/dashboard.php` |

Outputs a row for the Recent Comments widget.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/get_the_permalink/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.9.0](https://developer.wordpress.org/reference/since/3.9.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/functions/get_the_permalink/?output_format=md#user-contributed-notes)󠁿

 1.  [Skip to note 2 content](https://developer.wordpress.org/reference/functions/get_the_permalink/?output_format=md#comment-content-7416)
 2.   [Barrett Golding](https://profiles.wordpress.org/hearvox/)  [  5 months ago  ](https://developer.wordpress.org/reference/functions/get_the_permalink/#comment-7416)
 3. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_the_permalink%2F%23comment-7416)
    Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_the_permalink%2F%23comment-7416)
 4.     ```php
        get_the_permalink( $post_id, false );
        // Returns URL with post's slug, e.g.: "https://example.com/2025/01/my-post-title/"
    
        get_the_permalink( $post_id, true );
        // Returns URL with generic post placeholder: "https://example.com/2025/01/%postname%/"
        ```
    
 5.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_the_permalink%2F%3Freplytocom%3D7416%23feedback-editor-7416)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_the_permalink%2F)
before being able to contribute a note or feedback.