wp_get_attachment_link


wp_get_attachment_link ( $post = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false, $attr = '' )

Parameters:
  • (int|WP_Post) post Optional. Post ID or post object.
  • (string|int[]) size Optional. Image size. Accepts any registered image size name, or an array of width and height values in pixels (in that order). Default 'thumbnail'.
  • (bool) permalink Optional. Whether to add permalink to image. Default false.
  • (bool) icon Optional. Whether the attachment is an icon. Default false.
  • (string|false) text Optional. Link text to use. Activated by passing a string, false otherwise. Default false.
  • (array|string) attr Optional. Array or string of attributes. Default empty.
Returns:
  • (string) HTML content.
Defined at:
Change Log:
  • 4: .

Description

Retrieves an attachment page link using an image or icon, if possible.

Related Functions

get_attachment_link, wp_get_attachment_url, wp_get_attachment_caption, get_the_attachment_link, wp_get_attachment_image

Top Google Results

User discussions

wpseek mobile