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.9.8.1

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 863
    859
    860
    861
    862
    863
    864
    865
    866
    867
    868
    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 1323
    1319
    1320
    1321
    1322
    1323
    1324
    1325
    1326
    1327
    1328
    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 478
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
             * @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 519
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    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
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    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;
            }
        }