Summery Summery

Get the URL of an image attachment.

Syntax Syntax

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

Parameters Parameters


(int) (Required) Image attachment ID.


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

Default value: 'thumbnail'


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

Default value: false

Return Return

(string|false) Attachment URL or false if no image is available.

Source Source

File: wp-includes/media.php

		$attr = array_map( 'esc_attr', $attr );
		$html = rtrim( "<img $hwstring" );


Changelog Changelog

Version Description
4.4.0 Introduced.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.