get_attachment_link()
get_attachment_link( int|object $post = null, bool $leavename = false )
检索附件的永久链接。
Retrieves the permalink for an attachment.
说明(Description)
这可以在WordPress循环中使用,也可以在循环之外使用。
参数(Parameters)
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
$post | (int | object) | 可选 | Post ID或对象。默认使用全局$post。 |
$leavename | (bool) | 可选 | 是否保留页面名称。 |
返回(Return)
(string)附件permalink。
源码(Source)
更新版本 | 源码位置 | 使用 | 被使用 |
---|---|---|---|
2.0.0 | wp-includes/link-template.php:413 | 11 | 11 |
笔记(Notes)
默认用法
以列表形式显示附加的图像和标题
get_attachment_link() 为WP2原创文章,链接:https://www.wp2.cn/functions/get_attachment_link/