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?
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?
Share Improve this question edited Oct 1, 2018 at 8:18 Eh Jewel asked Dec 25, 2017 at 7:25 Eh JewelEh Jewel 8553 gold badges14 silver badges29 bronze badges 4 |2 Answers
Reset to default 4You need to change the type from textarea
to textarea_raw_html
:
- https://kb.wpbakery/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'] ) );
If you pass the vc_map param as param_name = 'content' the html wont get stripped off. The problem is you can only put one content.
array(
'type' => 'textarea',
'heading' => esc_html__( 'Texto', 'bauhaus' ),
'param_name' => 'content',
'holder' => 'div'
),
add_shortcode( 'custom_bloque_informativo', 'custom_bloque_informativo_func' );
function custom_bloque_informativo_func( $atts, $content ) {
ob_start();
}
strong
though. – rtpHarry Commented Sep 29, 2018 at 9:23textfield
param type which I linked to in my answer below. It's front end is not the tinymce based editor, it is a simple, plaintextarea
tag and it will strip the html in some situations. – rtpHarry Commented Sep 29, 2018 at 10:54