get_attachment_link

SummerySummery

Retrieves the permalink for an attachment.

Syntax

get_attachment_link( int|object $post = null, bool $leavename = false )

DescriptionDescription

This can be used in the WordPress Loop or outside of it.

ParametersParameters

$post

(int|object) (Optional) Post ID or object. Default uses the global $post.

Default value: null

$leavename

(bool) (Optional) Whether to keep the page name.

Default value: false

ReturnReturn

(string) The attachment permalink.

SourceSource

File: wp-includes/link-template.php


			

ChangelogChangelog

Changelog
Version Description
2.0.0 Introduced.
Scroll to Top