Hi @rsmith4321,
Please try the following code and see how it goes:
add_filter( 'forminator_change_form_allowed_html', function( $allowed_html ){
$allowed_html = array(
'h1' => array(),
'h2' => array(),
'h3' => array(),
'td' => array(),
);
return $allowed_html;
} );
You can add new HTML tags in the above format as the next line. Once the code is added you’ll have to re-add the HTML tags in the After Submission message, so that it would get saved correctly.
Please do let us know how that goes. Have a nice day ahead.
Kind Regards,
Nithin
Thanks, that does work better, I changed it to this
add_filter( 'forminator_change_form_allowed_html', function( $allowed_html ){
$allowed_html = array(
'h1' => array(),
'h2' => array(),
'h3' => array(),
'td' => array(),
'tr' => array(),
'tbody' => array(),
'table' => array(),
'span' => array(),
'img' => array(),
'div' => array(),
);
return $allowed_html;
} );
However it still seems to strip any styles and classes from the <div> tags as well as <span> tags. Do you have any suggestions? Also, is it correct to have a comma after the last item in the array? Thanks.
-
This reply was modified 5 years, 3 months ago by
rsmith4321.
-
This reply was modified 5 years, 3 months ago by
rsmith4321.
Hi @rsmith4321
I was able to replicate this on my lab site.
We pinged the plugin developers and will let you know once hearing back from the team.
Best Regards
Patrick Freitas
Hi @rsmith4321
I hope you are doing well.
Can you please try this code?
<?php
add_filter( 'forminator_change_form_allowed_html', function( $allowed_html ){
$allowed_html = array(
'h1' => array(),
'h2' => array(),
'h3' => array(),
'td' => array(),
'tr' => array(),
'tbody' => array(),
'table' => array(),
'span' => array(
'style' => true,
'class' => true,
),
'img' => array(),
'div' => array(
'style' => true,
'class' => true,
),
);
return $allowed_html;
} );
Best Regards
Patrick Freitas
Hi @rsmith4321
I hope you are doing well and safe!
We haven’t heard from you in a while, I’ll mark this thread as resolved.
Feel free to let us know if you have any additional question or problem.
Best Regards
Patrick Freitas
I finally had a chance to try the latest code. It’s still removing my
tags and for some reason adding in a
tag in it’s place. I really with there was a way just to disable filtering like the older versions, but if you have any other ideas I’ll try it. It’s finally not stripping the style tags with the latest version. Thanks.
I still haven’t been able to get this issue resolved, do you have any other ideas I can try to return the original functionality without stripping tags? Thanks!
Hi @rsmith4321
From my tests, the code worked.
Can you send the HTML that you are using and we can add it on our end and run a test to verify which ones are being removed?
Best Regards
Patrick Freitas
Thanks, I’m using the following tags like below, just real basic html with of course styles and classes inside the quotes and content in between.
<div style="" class=""></div> <h2 style=""></h2> <br/> <p></p> <b></b> <img style="" class=""> <table style=""><tbody><tr><td style=""></td></tr></tbody></table>
Thanks for the help.
Hi @rsmith4321
Sorry for the delay,
I tested it but seems forgot to update the ticket.
I was able to replicate using this HTML, I found we implemented some extra tags but others still being removed.
I sent this to our developers to verify why the filter isn’t working.
We will update once hearing back from the team.
Best Regards
Patrick Freitas
Hello @rsmith4321 ,
This issue will be fixed in 1.14.12 version of the plugin, please make sure to update plugin when new version will be released.
kind regards,
Kasia
When you say resolved do you mean I no longer need the code in my functions.php? Or just that it will work now with the code. What is the final recommendation for what I should add to my functions.php to get this working if it’s still needed?
Hi @rsmith4321,
At the moment, the tags will get stripped with the current solution used and I’m afraid there isn’t a workaround that could be suggested at the moment other than using one single HTML tags rather than multiple HTML tags.
This issue is more within the plugin side and this behaviour will be changed in the next plugin release ie v 1.14.12, so that the existing code suggested before would work out of the box.
At the moment, I’m afraid there isn’t any exact ETA that we could share regarding when the release would be made available. Hoping it would be soon.
Kind Regards,
Nithin