diff --git a/includes/api/legacy/v2/class-wc-api-products.php b/includes/api/legacy/v2/class-wc-api-products.php index c15f4941b2f..76bd68cfa34 100644 --- a/includes/api/legacy/v2/class-wc-api-products.php +++ b/includes/api/legacy/v2/class-wc-api-products.php @@ -1876,10 +1876,10 @@ class WC_API_Products extends WC_API_Resource { if ( $image_meta = @wp_read_image_metadata( $upload['file'] ) ) { if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) ) { - $title = $image_meta['title']; + $title = wc_clean( $image_meta['title'] ); } if ( trim( $image_meta['caption'] ) ) { - $content = $image_meta['caption']; + $content = wc_clean( $image_meta['caption'] ); } } diff --git a/includes/api/legacy/v3/class-wc-api-products.php b/includes/api/legacy/v3/class-wc-api-products.php index f1e7cb8b205..6f78e6d6201 100644 --- a/includes/api/legacy/v3/class-wc-api-products.php +++ b/includes/api/legacy/v3/class-wc-api-products.php @@ -2457,10 +2457,10 @@ class WC_API_Products extends WC_API_Resource { if ( $image_meta = @wp_read_image_metadata( $upload['file'] ) ) { if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) ) { - $title = $image_meta['title']; + $title = wc_clean( $image_meta['title'] ); } if ( trim( $image_meta['caption'] ) ) { - $content = $image_meta['caption']; + $content = wc_clean( $image_meta['caption'] ); } } diff --git a/includes/cli/class-wc-cli-product.php b/includes/cli/class-wc-cli-product.php index a3f07d4550a..c0f5c50a550 100644 --- a/includes/cli/class-wc-cli-product.php +++ b/includes/cli/class-wc-cli-product.php @@ -2073,10 +2073,10 @@ class WC_CLI_Product extends WC_CLI_Command { if ( $image_meta = @wp_read_image_metadata( $upload['file'] ) ) { if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) ) { - $title = $image_meta['title']; + $title = wc_clean( $image_meta['title'] ); } if ( trim( $image_meta['caption'] ) ) { - $content = $image_meta['caption']; + $content = wc_clean( $image_meta['caption'] ); } } diff --git a/includes/wc-rest-functions.php b/includes/wc-rest-functions.php index b4cfbe4f6c5..9e1ffcd0040 100644 --- a/includes/wc-rest-functions.php +++ b/includes/wc-rest-functions.php @@ -124,10 +124,10 @@ function wc_rest_set_uploaded_image_as_attachment( $upload, $id = 0 ) { if ( $image_meta = wp_read_image_metadata( $upload['file'] ) ) { if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) ) { - $title = $image_meta['title']; + $title = wc_clean( $image_meta['title'] ); } if ( trim( $image_meta['caption'] ) ) { - $content = $image_meta['caption']; + $content = wc_clean( $image_meta['caption'] ); } }