wc_get_attachment_image_attributes()WC 1.0

Get attachment image attributes.

Хуков нет.

Возвращает

Массив.

Использование

wc_get_attachment_image_attributes( $attr );
$attr(массив) (обязательный)
Image attributes.

Код wc_get_attachment_image_attributes() WC 7.1.0

function wc_get_attachment_image_attributes( $attr ) {
	/*
	 * If the user can manage woocommerce, allow them to
	 * see the image content.
	 */
	if ( current_user_can( 'manage_woocommerce' ) ) {
		return $attr;
	}

	/*
	 * If the user does not have the right capabilities,
	 * filter out the image source and replace with placeholder
	 * image.
	 */
	if ( isset( $attr['src'] ) && strstr( $attr['src'], 'woocommerce_uploads/' ) ) {
		$attr['src'] = wc_placeholder_img_src();

		if ( isset( $attr['srcset'] ) ) {
			$attr['srcset'] = '';
		}
	}
	return $attr;
}