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

TaxonomyTerms
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
wp-parser-source-filewp-includes/post-template.php

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

$id

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

$size

(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'

$permalink

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

Default value: false

$icon

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

Default value: false

$text

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

Default value: false

$attr

(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

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.