Remove accents from taxonomy names + run through filter Closes #3832
This commit is contained in:
parent
cabddc4e9f
commit
4204b25879
|
@ -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
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue