Do not sanitize old attribute name to not mess up comparing

This commit is contained in:
Coen Jacobs 2013-03-28 11:34:20 +01:00
parent 02beffda1f
commit 808e3024ca
1 changed files with 2 additions and 2 deletions

View File

@ -85,7 +85,7 @@ function woocommerce_attributes() {
$error = sprintf( __( 'Slug “%s” is already in use. Change it, please.', 'woocommerce' ), sanitize_title( $attribute_name ) ); $error = sprintf( __( 'Slug “%s” is already in use. Change it, please.', 'woocommerce' ), sanitize_title( $attribute_name ) );
} }
if ( 'edit' === $action ) { if ( 'edit' === $action ) {
$old_attribute_name = woocommerce_sanitize_taxonomy_name( $wpdb->get_var( "SELECT attribute_name FROM {$wpdb->prefix}woocommerce_attribute_taxonomies WHERE attribute_id = $attribute_id" ) ); $old_attribute_name = $wpdb->get_var( "SELECT attribute_name FROM {$wpdb->prefix}woocommerce_attribute_taxonomies WHERE attribute_id = $attribute_id" );
if ( $old_attribute_name != $attribute_name && $taxonomy_exists ) { if ( $old_attribute_name != $attribute_name && $taxonomy_exists ) {
$error = sprintf( __( 'Slug “%s” is already in use. Change it, please.', 'woocommerce' ), sanitize_title( $attribute_name ) ); $error = sprintf( __( 'Slug “%s” is already in use. Change it, please.', 'woocommerce' ), sanitize_title( $attribute_name ) );
} }
@ -130,7 +130,7 @@ function woocommerce_attributes() {
$wpdb->update( $wpdb->update(
$wpdb->term_taxonomy, $wpdb->term_taxonomy,
array( 'taxonomy' => $woocommerce->attribute_taxonomy_name( $attribute_name ) ), array( 'taxonomy' => $woocommerce->attribute_taxonomy_name( $attribute_name ) ),
array( 'taxonomy' => $woocommerce->attribute_taxonomy_name( $old_attribute_name ) ) array( 'taxonomy' => 'pa_' . $old_attribute_name )
); );
// Update taxonomy ordering term meta // Update taxonomy ordering term meta