I have a custom textarea filed for the product page.
woocommerce_wp_textarea_input(
array(
'id' => '_custom_product_calc',
'label' => __('Test', 'woocommerce')
)
);
$woocommerce_custom_product_calc = $_POST['_custom_product_calc'];
if (!empty($woocommerce_custom_product_calc))
update_post_meta($post_id, '_custom_product_calc', esc_html($woocommerce_custom_product_calc));
I need to use this field for insert some HTML code with JS. But, as you can see, the result is not what I've expected.
How can I change this? Or, maybe you know a better way to add a tab with HTML and JS for a product page? Clone Short description, for example?
Thanks!
esc_html
towp_kses
and supply it with an array of legal tags and their allowed attributes, you might get what you need. Though this looks like it's escaping when saving instead of outputting, which seems like the wrong way to go about this.