wpseek.com
Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.



wp_get_attachment_image_url › WordPress Function

Od4.4.0
Przestarzałyn/a
wp_get_attachment_image_url ( $attachment_id, $size = 'thumbnail', $icon = false )
Parametry: (3)
  • (int) $attachment_id Image attachment ID.
    Wymagane: Tak
  • (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'.
    Wymagane: Nie
    Domyślny: 'thumbnail'
  • (bool) $icon Optional. Whether the image should be treated as an icon. Default false.
    Wymagane: Nie
    Domyślny: false
Powrót:
  • (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.
Zdefiniowane na:
Codex:

Gets the URL of an image attachment.



Źródło

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