If you are trying to insert a piece of Javascript code in Gravity Forms HTML fields but the script tag gets removed when you update your form, then this tutorials will help you fix this problem by just adding a few line of code to your functions.php file.

Why the script tag gets removed

By default WordPress’s TinyMCE Editor will remove the <script> tags. But you can overwrite the default settings by just adding the below code to your functions.php file.


function allow_script_tags( $allowedposttags ){
    $allowedposttags['script'] = array(
        'type' => true,
        'src' => true,
        'height' => true,
        'width' => true,
    );   
    return $allowedposttags;
}
add_filter('wp_kses_allowed_html','allow_script_tags', 1);
 

Paste the above code to your functions.php and updated your page.  Now go to Gravity Form, you should be able to insert Javascript code and the <script> tags will not get removed when you update your form.

Thanks.

Josh Moore

Josh Moore

I love marketing and technology. I run Duoplus Online Marketing and enjoy helping companies grow their income especially through using online marketing effectively.
Previous post Unclogging a Drainage Website’s Pipes
Next post Google Apps – How to Create a Forwarding Email Address for FREE