wp_get_attachment_link( int|WP_Post $id, string|array $size = 'thumbnail', bool $permalink = false, bool $icon = false, string|false $text = false, array|string $attr = '' )

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

9 related functions found for: wp_get_attachment_link

Top ↑

Related terms found for this post

wp-parser-related-wordsattach, attachment, attachments, get, link, locat, location, post-template-php, post-typ, post-type, wp-get, wp-includes
wp-parser-packageTemplate, WordPress

Top ↑

Terms Used Terms Used

Terms used in the related posts query

  • attach
  • attachment
  • attachments
  • get
  • link
  • locat
  • location
  • post-template-php
  • post-typ
  • post-type
  • Template
  • wp-get
  • wp-includes
  • wp-includes/post-template.php
  • template

Top ↑

Description Description

Top ↑

Parameters Parameters


(int|WP_Post) (Optional) Post ID or post object.


(string|array) (Optional) Image size. Accepts any valid image size, or an array of width and height values in pixels (in that order).

Default value: 'thumbnail'


(bool) (Optional) Whether to add permalink to image.

Default value: false


(bool) (Optional) Whether the attachment is an icon.

Default value: false


(string|false) (Optional) Link text to use. Activated by passing a string, false otherwise.

Default value: false


(array|string) (Optional) Array or string of attributes.

Default value: ''

Top ↑

Return Return

(string) HTML content.

Top ↑

Source Source

File: wp-includes/post-template.php


Top ↑

Changelog Changelog

Version Description
4.4.0 The $id parameter can now accept either a post ID or WP_Post object.
2.5.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.