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:Defined at:Change Log: - Introduced in WordPress: 2.5.0
- Deprecated in WordPress: —
Description
Retrieves an attachment page link using an image or icon, if possible.