From 6130a222cca935a18d361643a9b2839fea88eb75 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Mon, 12 Mar 2018 15:52:26 -0300 Subject: [PATCH] Properly check for old and new slug while updating attributes Closes #19247 --- includes/wc-attribute-functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/wc-attribute-functions.php b/includes/wc-attribute-functions.php index cb4df866ae6..37d138516cf 100644 --- a/includes/wc-attribute-functions.php +++ b/includes/wc-attribute-functions.php @@ -450,7 +450,7 @@ function wc_create_attribute( $args ) { } elseif ( wc_check_if_attribute_name_is_reserved( $slug ) ) { /* translators: %s: attribute slug */ return new WP_Error( 'invalid_product_attribute_slug_reserved_name', sprintf( __( 'Slug "%s" is not allowed because it is a reserved term. Change it, please.', 'woocommerce' ), $slug ), array( 'status' => 400 ) ); - } elseif ( ( 0 === $id && taxonomy_exists( wc_attribute_taxonomy_name( $slug ) ) ) || ( isset( $args['old_slug'] ) && $args['old_slug'] !== $args['slug'] && taxonomy_exists( wc_attribute_taxonomy_name( $slug ) ) ) ) { + } elseif ( ( 0 === $id && taxonomy_exists( wc_attribute_taxonomy_name( $slug ) ) ) || ( isset( $args['old_slug'] ) && $args['old_slug'] !== $slug && taxonomy_exists( wc_attribute_taxonomy_name( $slug ) ) ) ) { /* translators: %s: attribute slug */ return new WP_Error( 'invalid_product_attribute_slug_already_exists', sprintf( __( 'Slug "%s" is already in use. Change it, please.', 'woocommerce' ), $slug ), array( 'status' => 400 ) ); }