get_post_permalink( int|WP_Post $post, bool $leavename = false, bool $sample = false )
Retrieves the permalink for a post of a custom post type.
Parameters
- $post
-
(Optional) Post ID or post object. Default is the global
$post
. - $leavename
-
(Optional) Whether to keep post name.
Default value: false
- $sample
-
(Optional) Is it a sample permalink.
Default value: false
Return
(string|false) The post permalink URL. False if the post does not exist.
Source
File: wp-includes/link-template.php
Changelog
Version | Description |
---|---|
6.1.0 | Returns false if the post does not exist. |
3.0.0 | Introduced. |