Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Mike Jolley (a11n)

    (@mikejolley)

    For variation attributes, this won’t be supported since they are output within ‘select’ inputs. These values get escaped on display so html won’t work.

    Thread Starter kahoferj

    (@kahoferj)

    Hi Mike,

    Thanks very much for your very quick reply.

    How about the product-level field? I’m finding HTML tags don’t work there either. Do I need to do something special?

    Plugin Contributor Mike Jolley (a11n)

    (@mikejolley)

    Regular attributes you mean? I believe all attribute values get escaped wherever they are – HTML is not allowed.

    TWIR

    (@mtgarmorydotcom)

    I know this is an old post but cant you remove the escaped html code on the product attributes page?

    I would assume this area would need to be changed in product-attirbutes.php.

    				if ( $attribute->is_taxonomy() ) {
    					$attribute_taxonomy = $attribute->get_taxonomy_object();
    					$attribute_values = wc_get_product_terms( $product->get_id(), $attribute->get_name(), array( 'fields' => 'all' ) );
    
    					foreach ( $attribute_values as $attribute_value ) {
    						$value_name = esc_html( $attribute_value->name );
    
    						if ( $attribute_taxonomy->attribute_public ) {
    							$values[] = '<a href="' . esc_url( get_term_link( $attribute_value->term_id, $attribute->get_name() ) ) . '" rel="tag">' . $value_name . '</a>';
    						} else {
    							$values[] = $value_name;
    						}
    					}
    				} else {
    					$values = $attribute->get_options();
    
    					foreach ( $values as &$value ) {
    						$value = esc_html( $value );
    					}
    				}
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘HTML tags in WooCommerce custom fields’ is closed to new replies.