wp_get_attachment_image_url

Advertisement

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

$attachment_id

(Required) Image attachment ID.

$size

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

Default value: 'thumbnail'

$icon

(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" );

Advertisement

Changelog Changelog

Changelog
Version Description
4.4.0 Introduced.

Advertisement

Leave a Reply