Fix saving of text attributes with special chars

Fixes #15238
This commit is contained in:
Mike Jolley 2017-05-24 18:01:19 +01:00
parent 5f28c733cc
commit 7f8add52a7
1 changed files with 2 additions and 1 deletions

View File

@ -73,7 +73,8 @@ class WC_Product_Attribute implements ArrayAccess {
if ( is_int( $option ) ) {
$term = get_term_by( 'id', $option, $this->get_name() );
} else {
$term = get_term_by( 'name', $option, $this->get_name() );
// Term names get escaped in WP. See sanitize_term_field.
$term = get_term_by( 'name', esc_attr( $option ), $this->get_name() );
if ( ! $term || is_wp_error( $term ) ) {
$new_term = wp_insert_term( $option, $this->get_name() );