The gwp_sanitize modifier is a merge tag modifier that allows to display sanitized values.


The modifier can be used within any Gravity Forms merge tag by appending it with specific attributes that define the sanitization behavior. The basic syntax is as follows:

{field:1:gwp_sanitize type="sanitize_text_field"}


  • type – Specifies the sanitization method to be applied. Options include sanitize_text_field, sanitize_title_with_dashes, and trim.

Supported Sanitization Types

  • sanitize_text_field – Utilizes WordPress’s sanitize_text_field() function to strip all tags and encode special characters from the string.
  • sanitize_title_with_dashes – Employs sanitize_title_with_dashes() to sanitize a title or slug, replacing whitespace and a few other characters with dashes.
  • trim – Simply trims whitespace from the beginning and end of the string using PHP’s trim() function.
Advanced Merge Tagsv1.4

To use the functionalities described in this documentation, you'll need to get the GravityWP - Advanced Merge Tags add-on.

Read more