HTML In Attributes
-
So in earlier versions of woocommerce I was able to do it. I recently did a huge update for an old site that is now active. The problem is it looks like the ability to allow html in attributes is no longer allowed. It is being stripped. It looks like it is done via eschtml
here is the section of code in products attributes i imagine needs to be tweaked to allow html. Keep in mind there is no payment gateway or anything. Nor will the site allow customers to create accounts. So I am not worried about any vulnerabilities there.
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 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘HTML In Attributes’ is closed to new replies.