get_permalink

SummerySummery

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

Syntax

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

ParametersParameters

$post

(int|WP_Post) (Optional) Post ID or post object. Default is the global $post.

$leavename

(bool) (Optional) Whether to keep post name or page name.

Default value: false

ReturnReturn

(string|false) The permalink URL or false if post does not exist.

SourceSource

File: wp-includes/link-template.php


			

ChangelogChangelog

Changelog
Version Description
1.0.0 Introduced.
Scroll to Top