wp_get_attachment_image_src( int $attachment_id, string|array $size = 'thumbnail', bool $icon = false )

Retrieve an image to represent an attachment.


7 related functions found for: wp_get_attachment_image_src

Top ↑

Related terms found for this post

TaxonomyTerms
wp-parser-related-wordsattach, attachment, attachments, get, imag, image, images, locat, location, media-php, post-typ, post-type, src, wp-get, wp-includes
wp-parser-packageMedia, WordPress
wp-parser-source-filewp-includes/media.php

Top ↑

Terms Used Terms Used

Terms used in the related posts query

  • attach
  • attachment
  • attachments
  • get
  • imag
  • image
  • images
  • locat
  • location
  • Media
  • media-php
  • post-typ
  • post-type
  • src
  • wp-get
  • wp-includes
  • wp-includes/media.php
  • media

Top ↑

Description Description

A mime icon for files, thumbnail or intermediate size for images.

The returned array contains four values: the URL of the attachment image src, the width of the image file, the height of the image file, and a boolean representing whether the returned array describes an intermediate (generated) image size or the original, full-sized upload.


Top ↑

Parameters Parameters

$attachment_id

(int) (Required) Image attachment ID.

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

$icon

(bool) (Optional) Whether the image should be treated as an icon.

Default value: false


Top ↑

Return Return

(false|array) Returns an array (url, width, height, is_intermediate), or false, if no image is available.


Top ↑

Source Source

File: wp-includes/media.php


			

Top ↑

Changelog Changelog

Changelog
Version Description
2.5.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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