Codex tools: Log in / create account
Contents |
Returns the URI of the page for an attachment.
Under a "pretty" permalink structure, the function returns something like http://wp.example.net/path_to_post/post_name/attachment_name.
Under the default permalink structure — or if Wordpress can't construct a pretty URI — the function returns something like http://wp.example.net/?attachment_id=n, where n is the attachment ID number.
You can change the output of this function through the attachment_link filter.
If you want a direct link to the attached file (instead of the attachment page), you can use the function wp_get_attachment_url(id) instead.
Note that get_attachment_link actually returns an URI, whereas get_the_attachment_link returns an HTML hyperlink.