From f7ef9c0cec1c4766d8d528c16860a715bc944c61 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Wed, 16 Dec 2015 16:46:31 -0200 Subject: [PATCH] [API] Stop unset things in API --- includes/api/class-wc-api-products.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/includes/api/class-wc-api-products.php b/includes/api/class-wc-api-products.php index f9549a88c84..e9b7e26bce5 100644 --- a/includes/api/class-wc-api-products.php +++ b/includes/api/class-wc-api-products.php @@ -910,10 +910,7 @@ class WC_API_Products extends WC_API_Resource { $data = wp_parse_args( $data['product_tag'], $defaults ); $data = apply_filters( 'woocommerce_api_create_product_tag_data', $data, $this ); - $name = $data['name']; - unset( $data['name'] ); - - $insert = wp_insert_term( $name, 'product_tag', $data ); + $insert = wp_insert_term( $data['name'], 'product_tag', $data ); if ( is_wp_error( $insert ) ) { throw new WC_API_Exception( 'woocommerce_api_cannot_create_product_tag', $insert->get_error_message(), 400 ); } @@ -3336,9 +3333,6 @@ class WC_API_Products extends WC_API_Resource { $data = wp_parse_args( $data['product_shipping_class'], $defaults ); $data = apply_filters( 'woocommerce_api_create_product_shipping_class_data', $data, $this ); - $name = $data['name']; - unset( $data['name'] ); - // Check parent. $data['parent'] = absint( $data['parent'] ); if ( $data['parent'] ) { @@ -3348,7 +3342,7 @@ class WC_API_Products extends WC_API_Resource { } } - $insert = wp_insert_term( $name, 'product_shipping_class', $data ); + $insert = wp_insert_term( $data['name'], 'product_shipping_class', $data ); if ( is_wp_error( $insert ) ) { throw new WC_API_Exception( 'woocommerce_api_cannot_create_product_shipping_class', $insert->get_error_message(), 400 ); }