diff --git a/includes/admin/class-wc-admin-attributes.php b/includes/admin/class-wc-admin-attributes.php index b72847029ef..eddb050e2d0 100644 --- a/includes/admin/class-wc-admin-attributes.php +++ b/includes/admin/class-wc-admin-attributes.php @@ -59,7 +59,8 @@ class WC_Admin_Attributes { // Auto-generate the label or slug if only one of both was provided if ( ! $attribute_label ) { $attribute_label = ucwords( $attribute_name ); - } elseif ( ! $attribute_name ) { + } + if ( ! $attribute_name ) { $attribute_name = woocommerce_sanitize_taxonomy_name( stripslashes( $attribute_label ) ); } @@ -198,11 +199,9 @@ class WC_Admin_Attributes { } } - // If an attribute was added, edited or deleted: clear cache and redirect + // If an attribute was added, edited or deleted: clear cache if ( ! empty( $action_completed ) ) { delete_transient( 'wc_attribute_taxonomies' ); - wp_safe_redirect( get_admin_url() . 'edit.php?post_type=product&page=woocommerce_attributes' ); - exit; } // Show admin interface diff --git a/includes/wc-formatting-functions.php b/includes/wc-formatting-functions.php index 636198722ef..07244e614b2 100644 --- a/includes/wc-formatting-functions.php +++ b/includes/wc-formatting-functions.php @@ -22,12 +22,12 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly * @return void */ function woocommerce_sanitize_taxonomy_name( $taxonomy ) { - $taxonomy = strtolower( stripslashes( strip_tags( $taxonomy ) ) ); - $taxonomy = preg_replace( '/&.+?;/', '', $taxonomy ); // Kill entities - $taxonomy = str_replace( array( '.', '\'', '"' ), '', $taxonomy ); // Kill quotes and full stops. - $taxonomy = str_replace( array( ' ', '_' ), '-', $taxonomy ); // Replace spaces and underscores. + $filtered = strtolower( remove_accents( stripslashes( strip_tags( $taxonomy ) ) ) ); + $filtered = preg_replace( '/&.+?;/', '', $filtered ); // Kill entities + $filtered = str_replace( array( '.', '\'', '"' ), '', $filtered ); // Kill quotes and full stops. + $filtered = str_replace( array( ' ', '_' ), '-', $filtered ); // Replace spaces and underscores. - return $taxonomy; + return apply_filters( 'sanitize_taxonomy_name', $filtered, $taxonomy ); } /**