1. 首页
  2. WordPress 函数手册

get_the_permalink()

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

检索当前文章或文章ID的完整永久链接。
Retrieves the full permalink for the current post or post ID.

目录锚点:#说明#参数#返回#源码


说明(Description)

另见函数 get_permalink()


参数(Parameters)

参数 类型 必填 说明
$post (int | WP_Post) 可选 Post ID或Post对象。默认值为全局$post。
$leavename (bool) 可选 是保留文章名还是页面名。

返回(Return)

(string|false)永久链接URL,如果post不存在则为false。


源码(Source)


更新版本 源码位置 使用 被使用
3.9.0 wp-includes/link-template.php:106 1 function 1 function

get_the_permalink() 为WP2原创文章,链接:https://www.wp2.cn/functions/get_the_permalink/