函数原型
get_the_permalink( int|WP_Post $post, bool $leavename = false ): string|false
函数描述
Retrieves the full permalink for the current post or post ID.
是否弃用
未弃用
函数参数
-
$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:
false
函数返回值
string|false The permalink URL. False if the post does not exist.
函数位置
File: wp-includes/link-template.php.
函数源码
function get_the_permalink( $post = 0, $leavename = false ) {
return get_permalink( $post, $leavename );
}
源码链接
变更日志
| Version | Description |
|---|---|
| 3.9.0 | Introduced. |

