wp_get_attachment_link


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

Parameters:
  • (int|WP_Post) $id Optional. Post ID or post object.
  • (string|array) $size Optional. Image size. Accepts any valid image size, 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

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

Related Functions

get_attachment_link, wp_get_attachment_url, wp_get_attachment_caption, wp_get_attachment_image, get_the_attachment_link

Top Google Results

User discussions

wpseek mobile