woocommerce_rest_suppress_image_upload_error

woocommerce_rest_suppress_image_upload_error

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter

See hook in core

Displaying hooks found in version: woocommerce.8.7.0

apply_filters('woocommerce_rest_suppress_image_upload_error') is found 5 times:

  • /includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php line 858
    				if ( 0 === $attachment_id && isset( $image['src'] ) ) {
    					$upload = wc_rest_upload_image_from_url( esc_url_raw( $image['src'] ) );
    
    					if ( is_wp_error( $upload ) ) {
    						if ( ! apply_filters( 'woocommerce_rest_suppress_image_upload_error', false, $upload, $product->get_id(), $images ) ) {
    							throw new WC_REST_Exception( 'woocommerce_product_image_upload_error', $upload->get_error_message(), 400 );
    						} else {
    							continue;
    						}
    					}
    
    
  • /includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php line 1298
    				if ( 0 === $attachment_id && isset( $image['src'] ) ) {
    					$upload = wc_rest_upload_image_from_url( esc_url_raw( $image['src'] ) );
    
    					if ( is_wp_error( $upload ) ) {
    						if ( ! apply_filters( 'woocommerce_rest_suppress_image_upload_error', false, $upload, $product->get_id(), $images ) ) {
    							throw new WC_REST_Exception( 'woocommerce_product_image_upload_error', $upload->get_error_message(), 400 );
    						} else {
    							continue;
    						}
    					}
    
    
  • /includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php line 450
    					 * @param array         $upload Uploaded image array.
    					 * @param int id   Variation id.
    					 * @param array    Array of image to set.
    					 */
    					if ( ! apply_filters( 'woocommerce_rest_suppress_image_upload_error', false, $upload, $variation->get_id(), array( $image ) ) ) {
    						throw new WC_REST_Exception( 'woocommerce_variation_image_upload_error', $upload->get_error_message(), 400 );
    					}
    				}
    
    				$attachment_id = wc_rest_set_uploaded_image_as_attachment( $upload, $variation->get_id() );
    			} else {
    
  • /includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php line 354
    				if ( 0 === $attachment_id && isset( $image['src'] ) ) {
    					$upload = wc_rest_upload_image_from_url( esc_url_raw( $image['src'] ) );
    
    					if ( is_wp_error( $upload ) ) {
    						if ( ! apply_filters( 'woocommerce_rest_suppress_image_upload_error', false, $upload, $product->get_id(), $images ) ) {
    							throw new WC_REST_Exception( 'woocommerce_product_image_upload_error', $upload->get_error_message(), 400 );
    						} else {
    							continue;
    						}
    					}
    
    
  • /includes/rest-api/Utilities/ImageAttachment.php line 50
    	public function upload_image_from_src( $src ) {
    		$upload = wc_rest_upload_image_from_url( esc_url_raw( $src ) );
    
    		if ( is_wp_error( $upload ) ) {
    			if ( ! apply_filters( 'woocommerce_rest_suppress_image_upload_error', false, $upload, $this->object_id, $images ) ) {
    				throw new \WC_REST_Exception( 'woocommerce_product_image_upload_error', $upload->get_error_message(), 400 );
    			} else {
    				return;
    			}
    		}