woocommerce_rest_suppress_image_upload_error хук-фильтрWC 4.5.0

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

Использование

add_filter( 'woocommerce_rest_suppress_image_upload_error', 'wp_kama_woocommerce_rest_suppress_image_upload_error_filter', 10, 4 );

/**
 * Function for `woocommerce_rest_suppress_image_upload_error` filter-hook.
 * 
 * @param bool  $false        false If it should suppress.
 * @param array $upload       Uploaded image array.
 * @param int   $variation_id id Variation id.
 * @param array $array        Array of image to set.
 *
 * @return bool
 */
function wp_kama_woocommerce_rest_suppress_image_upload_error_filter( $false, $upload, $variation_id, $array ){

	// filter...
	return $false;
}
$false(true|false)
false If it should suppress.
$upload(массив)
Uploaded image array.
$variation_id(int)
id Variation id.
$array(массив)
Array of image to set.

Список изменений

С версии 4.5.0 Введена.

Где вызывается хук

WC_REST_Product_Variations_Controller::set_variation_image()
woocommerce_rest_suppress_image_upload_error
WC_REST_Products_V2_Controller::set_product_images()
woocommerce_rest_suppress_image_upload_error
WC_REST_Products_V1_Controller::set_product_images()
woocommerce_rest_suppress_image_upload_error
WC_REST_Products_Controller::set_product_images()
woocommerce_rest_suppress_image_upload_error
ImageAttachment::upload_image_from_src()
woocommerce_rest_suppress_image_upload_error
woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-product-variations-controller.php 457
if ( ! apply_filters( 'woocommerce_rest_suppress_image_upload_error', false, $upload, $variation->get_id(), array( $image ) ) ) {
woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-products-v2-controller.php 1302
if ( ! apply_filters( 'woocommerce_rest_suppress_image_upload_error', false, $upload, $product->get_id(), $images ) ) {
woocommerce/includes/rest-api/Controllers/Version1/class-wc-rest-products-v1-controller.php 858
if ( ! apply_filters( 'woocommerce_rest_suppress_image_upload_error', false, $upload, $product->get_id(), $images ) ) {
woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-products-controller.php 414
if ( ! apply_filters( 'woocommerce_rest_suppress_image_upload_error', false, $upload, $product->get_id(), $images ) ) {
woocommerce/includes/rest-api/Utilities/ImageAttachment.php 50
if ( ! apply_filters( 'woocommerce_rest_suppress_image_upload_error', false, $upload, $this->object_id, $images ) ) {

Где используется хук в WooCommerce

Использование не найдено.