WPDev.one
Core Function
View Source on Trac ↗

get_post_permalink()

get_post_permalink( mixed $post = 0, mixed $leavename = false, mixed $sample = false )

Retrieves the permalink for a post of a custom post type.

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. Default false.

$sample
bool

Optional. Is it a sample permalink. Default false.

Return Value

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

Function Information

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