From d5a74203c2cd7f335f7b256e9732d36971b32966 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Fri, 10 Jul 2015 10:48:29 +0100 Subject: [PATCH] Only need one numeric check --- includes/api/class-wc-api-products.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/includes/api/class-wc-api-products.php b/includes/api/class-wc-api-products.php index 694a0f5bd61..f96193837e9 100644 --- a/includes/api/class-wc-api-products.php +++ b/includes/api/class-wc-api-products.php @@ -291,11 +291,7 @@ class WC_API_Products extends WC_API_Resource { return $this->get_product( $id ); } catch ( WC_API_Exception $e ) { - // Remove the product when fails (and post actually created) - if ( is_int( $id ) ) { - $this->clear_product( $id ); - } - + $this->clear_product( $id ); return new WP_Error( $e->getErrorCode(), $e->getMessage(), array( 'status' => $e->getCode() ) ); } } @@ -2322,7 +2318,7 @@ class WC_API_Products extends WC_API_Resource { * Clear product */ protected function clear_product( $product_id ) { - if ( !is_int( $product_id ) || 0 >= $product_id ) { + if ( ! is_numeric( $product_id ) || 0 >= $product_id ) { return; }