get_attachment_link


get_attachment_link ( $post = null, $leavename = false )

Parameters:
  • (int|object) $post Optional. Post ID or object. Default uses the global `$post`.
  • (bool) $leavename Optional. Whether to keep the page name. Default false.
Returns:
  • (string) The attachment permalink.
Defined at:

Description

Retrieves the permalink for an attachment.

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

Related Functions

wp_get_attachment_link, get_the_attachment_link, the_attachment_link, get_attachment_icon, the_attachment_links

Top Google Results

User discussions

wpseek mobile