While writing a custom element for WC Bakery (formerly Visual Composer) I’ve discovered that the HTML tags are being stripped from the textfield
parameter type. It’s sanitizing the textfield
value by default.
I could not find a way to disable the textfield
sanitization.
How can I allow HTML tags to be entered into this field?
You need to change the type from textarea
to textarea_raw_html
:
- https://kb.wpbakery.com/docs/inner-api/vc_map/
Under the section “Available type values” it says:
textarea_raw_html: Text area, its content will be coded into base64 (this allows you to store raw js or raw html code)
Although I’m not sure why they can base64 encode the output from this but not the textarea_html
box with its nice formatting – an annoying limitation.
UPDATE It looks like you have to jump through some hoops when you switch to the textarea_raw_html
param type.
To use the value you need to manually decode it with:
$atts['some_param'] = rawurldecode( base64_decode( $atts['some_param'] ) );