A WordPress-centric search engine for devs and theme authors



wp_get_attachment_image_url ›

Since4.4.0
Deprecatedn/a
wp_get_attachment_image_url ( $attachment_id, $size = 'thumbnail', $icon = false )
Parameters: (3)
  • (int) $attachment_id Image attachment ID.
    Required: Yes
  • (string|array) $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'.
    Required: No
    Default: 'thumbnail'
  • (bool) $icon Optional. Whether the image should be treated as an icon. Default false.
    Required: No
    Default: false
Returns:
  • (string|false) Attachment URL or false if no image is available.
Defined at:
Codex:

Get the URL of an image attachment.



Source

function wp_get_attachment_image_url( $attachment_id, $size = 'thumbnail', $icon = false ) {
	$image = wp_get_attachment_image_src( $attachment_id, $size, $icon );
	return isset( $image['0'] ) ? $image['0'] : false;
}