Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- WooCommerce - Attribute value containing html
- add_filter( 'woocommerce_attribute', 'custom_attribute_filter', 10, 2 );
- function custom_attribute_filter( $value, $attribute ) {
- // $value is filtered
- $attribute_name = $attribute->get_name();
- if( 'attribute_with html_name' == $attribute_name ) {
- $options = $attribute->get_options();
- $value = $options[0]; // unfiltered value
- $value = html_entity_decode( $value, ENT_COMPAT | ENT_HTML5 );
- }
- return $value;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement