Title: Code in text fields
Last modified: September 22, 2022

---

# Code in text fields

 *  Resolved [Ralph](https://wordpress.org/support/users/ralph001/)
 * (@ralph001)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/code-in-text-fields/)
 * Hi team,
 * I am contemplating switching to forminator on all my websites but I have a security
   issue that I want to clarify first.
 * When I create a text field (not rich text) I want the text to be stripped of 
   any code. A good example is a contact us form with a message field, if I add 
   any type of code in the message field, the text should be stripped of all code
   and converted to plain text.
 * is this possible?

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Support [Jair – WPMU DEV Support](https://wordpress.org/support/users/wpmudevsupport15/)
 * (@wpmudevsupport15)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/code-in-text-fields/#post-16035280)
 * Hi [@ralph001](https://wordpress.org/support/users/ralph001/),
 * I hope you are doing well today!
 * This issue has been flagged to our SLS (Second Line Support) Team so that they
   can dig into this further. We will post an update here as soon as more information
   is available.
 * Thank you for your patience while we look into this further.
 * Kind regards,
    Zafer
 *  Plugin Support [Jair – WPMU DEV Support](https://wordpress.org/support/users/wpmudevsupport15/)
 * (@wpmudevsupport15)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/code-in-text-fields/#post-16035307)
 * Hi again [@ralph001](https://wordpress.org/support/users/ralph001/),
 * Please try the following code snippet as mu-plugin and change 361 with your form
   ID.
 * You can find more information below on how to use mu-plugins.
    [https://wpmudev.com/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins](https://wpmudev.com/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins)
 *     ```
       <?php
       add_filter( 'forminator_prepared_data', 'wpmudev_strip_textarea_html', 10, 2 );
       function wpmudev_strip_textarea_html( $prepared_data, $module_object ){
           if( $module_object->id != 361 ){ //Please change form ID
               return $prepared_data;
           }
   
           foreach( $prepared_data as $key => $value ){
               if(    strpos( $key, 'text' ) !== false ){
                   if( $value ){
                       $prepared_data[ $key ] = strip_tags( $value );
                   }
               }
           }
   
           return $prepared_data;
       }
       ```
   
 * Kind regards,
    Zafer
 *  Thread Starter [Ralph](https://wordpress.org/support/users/ralph001/)
 * (@ralph001)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/code-in-text-fields/#post-16036738)
 * Hi team,
 * thank you for the prompt reply, I shall test this and will let you know if it
   works.
 * Regards,
    Ralph
 *  Plugin Support [Amin – WPMU DEV Support](https://wordpress.org/support/users/wpmudev-support2/)
 * (@wpmudev-support2)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/code-in-text-fields/#post-16058485)
 * Hello [@ralph001](https://wordpress.org/support/users/ralph001/) ,
 * We haven’t heard from you for a week now, so it looks like you don’t have any
   more questions for us.
 * Feel free to re-open this ticket if
    needed.
 * Kind regards
    Kasia
 *  Thread Starter [Ralph](https://wordpress.org/support/users/ralph001/)
 * (@ralph001)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/code-in-text-fields/#post-16060733)
 * I tested the code and So far it’s working fine, Thank you!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Code in text fields’ is closed to new replies.

 * ![](https://ps.w.org/forminator/assets/icon-256x256.gif?rev=3443182)
 * [Forminator Forms – Contact Form, Payment Form & Custom Form Builder](https://wordpress.org/plugins/forminator/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/forminator/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/forminator/)
 * [Active Topics](https://wordpress.org/support/plugin/forminator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/forminator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/forminator/reviews/)

 * 5 replies
 * 3 participants
 * Last reply from: [Ralph](https://wordpress.org/support/users/ralph001/)
 * Last activity: [3 years, 7 months ago](https://wordpress.org/support/topic/code-in-text-fields/#post-16060733)
 * Status: resolved