WPDev.one
Core Function
View Source on Trac ↗

get_permalink()

get_permalink( mixed $post = 0, mixed $leavename = false )

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

Parameters 1 required

Name / Type Description
(int

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

Required
$leavename
bool

Optional. Whether to keep post name or page name. Default false.

Return Value

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

Function Information

Since Version
1.0.0
Source File
wp-includes/link-template.php
Advertisement