From 178f98ff6534835bcc129c08312a14575568a242 Mon Sep 17 00:00:00 2001 From: claudiulodro Date: Wed, 19 Sep 2018 11:35:46 -0700 Subject: [PATCH] Fix attribute saving --- includes/abstracts/abstract-wc-product.php | 2 +- includes/class-wc-ajax.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/abstracts/abstract-wc-product.php b/includes/abstracts/abstract-wc-product.php index ebb0a052f99..a6f2cd5bb16 100644 --- a/includes/abstracts/abstract-wc-product.php +++ b/includes/abstracts/abstract-wc-product.php @@ -1104,7 +1104,7 @@ class WC_Product extends WC_Abstract_Legacy_Product { $attributes = array_fill_keys( array_keys( $this->get_attributes( 'edit' ) ), null ); foreach ( $raw_attributes as $attribute ) { if ( is_a( $attribute, 'WC_Product_Attribute' ) ) { - $attributes[ sanitize_text_field( $attribute->get_name() ) ] = $attribute; + $attributes[ sanitize_title( $attribute->get_name() ) ] = $attribute; } } diff --git a/includes/class-wc-ajax.php b/includes/class-wc-ajax.php index bd6907d02c5..51500c6c916 100644 --- a/includes/class-wc-ajax.php +++ b/includes/class-wc-ajax.php @@ -631,7 +631,7 @@ class WC_AJAX { $i = -1; foreach ( $data['attribute_names'] as $attribute_name ) { - $attribute = isset( $attributes[ $attribute_name ] ) ? $attributes[ $attribute_name ] : false; + $attribute = isset( $attributes[ sanitize_title( $attribute_name ) ] ) ? $attributes[ sanitize_title( $attribute_name ) ] : false; if ( ! $attribute ) { continue; }