From 8c523ee0b9c59c17bda81441e0ab58ac05768c45 Mon Sep 17 00:00:00 2001 From: claudiulodro Date: Fri, 1 Sep 2017 11:14:48 -0700 Subject: [PATCH] Remove featured image on empty image array --- includes/api/class-wc-rest-products-controller.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/api/class-wc-rest-products-controller.php b/includes/api/class-wc-rest-products-controller.php index fc82151a6df..beb49effc65 100644 --- a/includes/api/class-wc-rest-products-controller.php +++ b/includes/api/class-wc-rest-products-controller.php @@ -1033,7 +1033,7 @@ class WC_REST_Products_Controller extends WC_REST_Legacy_Products_Controller { * @return WC_Product */ protected function set_product_images( $product, $images ) { - if ( is_array( $images ) ) { + if ( is_array( $images ) && ! empty( $images ) ) { $gallery = array(); foreach ( $images as $image ) {