WordPress filter hook

woocommerce_rest_suppress_image_upload_error

Defined by WooCommerce and fired by 8 plugins in total, running on 7M+ sites between them.

“Filter to check if it should suppress the image upload error, false by default.”

How to use woocommerce_rest_suppress_image_upload_error

It's a filter: your callback receives the value and 3 more arguments, and must return the (changed) value. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_filter( 'woocommerce_rest_suppress_image_upload_error', function( $value, $upload, $arg3, $images ) {
	// Change $value here.
	return $value;
}, 10, 4 );

Argument names come from Dokan: AI Powered WooCommerce Multivendor Marketplace Solution's source. Other plugins may pass different values: check the call in the plugin you're targeting below.

8 plugins that fire woocommerce_rest_suppress_image_upload_error

Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.

  1. WooCommerce icon WooCommerce7+ million installs apply_filters( 'woocommerce_rest_suppress_image_upload_error', false, $upload, $variation->get_id(), array( $image ) ) includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php:528
  2. Dokan: AI Powered WooCommerce Multivendor Marketplace Solution icon Dokan: AI Powered WooCommerce Multivendor Marketplace Solution30,000+ installs apply_filters( 'woocommerce_rest_suppress_image_upload_error', false, $upload, $product->get_id(), $images ) includes/REST/ProductController.php:1852
  3. WCFM icon WCFM10,000+ installs apply_filters( 'woocommerce_rest_suppress_image_upload_error', false, $upload, $new_product_id, $wcfm_products_manage_form_data['featured_img'] ) controllers/products-manager/wcfm-controller-products-manage.php:446
  4. AppScenic icon AppScenic3,000+ installs apply_filters( 'woocommerce_rest_suppress_image_upload_error', false, $upload, $product->get_id(), [$image] ) src/Import/ProductImporter.php:51
  5. WCFM icon WCFM1,000+ installs apply_filters( 'woocommerce_rest_suppress_image_upload_error', false, $upload, $product->get_id(), $images ) includes/api/class-api-product-controller.php:369
  6. DataFeedWatch Connector for WooCommerce icon DataFeedWatch Connector for WooCommerce600+ installs apply_filters( 'woocommerce_rest_suppress_image_upload_error', false, $upload, $termId, [$item['image']] ) bridge2cart/bridge.php:2450
  7. Api2Cart Bridge Connector icon Api2Cart Bridge Connector40+ installs apply_filters( 'woocommerce_rest_suppress_image_upload_error', false, $upload, $termId, [$item['image']] ) bridge2cart/bridge.php:2450
  8. Superstore icon SuperstoreFewer than 10 installs apply_filters( 'woocommerce_rest_suppress_image_upload_error', false, $upload, $product->get_id(), $images ) includes/RESTAPI/Product.php:1415

Need a customisation built on this hook?

Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.