WC_Product_CSV_Importer::parse_images_field( string $value )

Parse images list from a CSV. Images can be filenames or URLs.


Description Description


Parameters Parameters

$value

(Required) Field value.


Top ↑

Return Return

(array)


Top ↑

Source Source

File: includes/import/class-wc-product-csv-importer.php

	public function parse_images_field( $value ) {
		if ( empty( $value ) ) {
			return array();
		}

		$images    = array();
		$separator = apply_filters( 'woocommerce_product_import_image_separator', ',' );

		foreach ( $this->explode_values( $value, $separator ) as $image ) {
			if ( stristr( $image, '://' ) ) {
				$images[] = esc_url_raw( $image );
			} else {
				$images[] = sanitize_file_name( $image );
			}
		}

		return $images;
	}


Top ↑

User Contributed Notes User Contributed Notes

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