wpseek.com
WordPress开发者和主题制作者的搜索引擎



wp_get_attachment_image_url › WordPress Function

Since4.4.0
已弃用n/a
wp_get_attachment_image_url ( $attachment_id, $size = 'thumbnail', $icon = false )
参数: (3)
  • (int) $attachment_id Image attachment ID.
    Required: Yes
  • (string|int[]) $size Optional. Image size. Accepts any registered image size name, or an array of width and height values in pixels (in that order). Default 'thumbnail'.
    Required: No
    默认: 'thumbnail'
  • (bool) $icon Optional. Whether the image should be treated as an icon. Default false.
    Required: No
    默认: false
返回:
  • (string|false) Attachment URL or false if no image is available. If `$size` does not match any registered image size, the original image URL will be returned.
定义在:
文档:

Gets the URL of an image attachment.



源码

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;
}