wc_prepare_attachment_for_js( array $response )

Prepare attachment for JavaScript.


Description Description


Parameters Parameters

$response

(Required) JS version of a attachment post object.


Top ↑

Return Return

(array)


Top ↑

Source Source

File: includes/wc-product-functions.php

function wc_prepare_attachment_for_js( $response ) {

	if ( isset( $response['url'] ) && strstr( $response['url'], 'woocommerce_uploads/' ) ) {
		$response['full']['url'] = wc_placeholder_img_src();
		if ( isset( $response['sizes'] ) ) {
			foreach ( $response['sizes'] as $size => $value ) {
				$response['sizes'][ $size ]['url'] = wc_placeholder_img_src();
			}
		}
	}

	return $response;
}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.