Core Function
View Source on Trac ↗ get_attachment_link()
get_attachment_link( mixed $post = null, mixed $leavename = false ) Retrieves the permalink for an attachment.
Parameters 1 required
| Name / Type | Description |
|---|---|
| (int | | WP_Post) $post Optional. Post ID or object. Default uses the global `$post`. Required |
| $leavename bool | Optional. Whether to keep the page name. Default false. |
Return Value
(string)
The attachment permalink.
Function Information
Since Version
2.0.0
Source File
wp-includes/link-template.php
Advertisement