CARVIEW |
Select Language
HTTP/2 301
date: Sat, 11 Oct 2025 17:37:27 GMT
content-type: text/html; charset=UTF-8
location: https://docs.gravityforms.com/gform_value_pre_duplicate_check/
server: cloudflare
strict-transport-security: max-age=604800
strict-transport-security: max-age=31536000; includeSubDomains
x-content-type-options: nosniff
x-content-type-options: nosniff
x-xss-protection: 1; mode=block
x-xss-protection: 1; mode=block
x-frame-options: SAMEORIGIN
x-frame-options: SAMEORIGIN
referrer-policy: no-referrer
referrer-policy: strict-origin-when-cross-origin
x-redirect-by: WordPress
fastcgi-cache: MISS
cf-cache-status: DYNAMIC
nel: {"report_to":"cf-nel","success_fraction":0.0,"max_age":604800}
report-to: {"group":"cf-nel","max_age":604800,"endpoints":[{"url":"https://a.nel.cloudflare.com/report/v4?s=wTof5yH9RX5PMIQALON6CmG13sKZgnhBGDT8rEHxXOE%2FcM41MBTIK5Bx82zY%2FXZxSTvwC2Jx6XI6ZanbbGIrikbiFigm2oc5JBjbIyXoRhmpictp"}]}
cf-ray: 98d0201b9f0375e9-BLR
HTTP/2 200
date: Sat, 11 Oct 2025 17:37:29 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
vary: Accept-Encoding
strict-transport-security: max-age=604800
strict-transport-security: max-age=31536000; includeSubDomains
x-content-type-options: nosniff
x-content-type-options: nosniff
x-xss-protection: 1; mode=block
x-xss-protection: 1; mode=block
x-frame-options: SAMEORIGIN
x-frame-options: SAMEORIGIN
referrer-policy: no-referrer
referrer-policy: strict-origin-when-cross-origin
link: ; rel="https://api.w.org/"
link: ; rel="alternate"; title="JSON"; type="application/json"
link: ; rel=shortlink
fastcgi-cache: HIT
report-to: {"group":"cf-nel","max_age":604800,"endpoints":[{"url":"https://a.nel.cloudflare.com/report/v4?s=8dtTalNM5%2BuiEgBAxa%2FJik1QPy4AEAmQSLRzb0l2b9FsylMk2S5whnRZFeStBph5l%2BUDzb%2FsMYetsYvMbg8La0NHVj%2BIbImFXSFDYslK4MByYNpD"}]}
cf-cache-status: DYNAMIC
nel: {"report_to":"cf-nel","success_fraction":0.0,"max_age":604800}
content-encoding: gzip
cf-ray: 98d020245a0a75e9-BLR
gform_value_pre_duplicate_check - Gravity Forms Documentation
gform_value_pre_duplicate_check
Description
The gform_value_pre_duplicate_check
The filter allows for the modification of the field value just before the duplicate check.
Usage
Applies to all forms:
add_filter( 'gform_value_pre_duplicate_check', 'your_function_name', 10, 3);
Parameters
- $value string or array
The value being checked against existing entries for duplicates. - $field GF_Field
The field being checked for duplicates. - $form_id int
The ID of the form being checked for duplicates.
Examples
Sanitize an email
Sanitize emails and consider values like [email protected]
the same as [email protected]
add_filter( 'gform_value_pre_duplicate_check', function ( $value, $field, $form_id ) {
if ( $field->type !== 'email' ) {
return $value;
}
$value = is_array( $value ) ? rgar( $value, 0, '' ) : $value;
$value = strtolower( $value );
if ( strpos( $value, '@gmail.com' ) === false || strpos( $value, '+' ) === false ) {
return $value;
}
$username = str_replace( '@gmail.com', '' , $value );
$username = substr( $username, 0 , strpos( $username, '+' ) );
return $username . '@gmail.com';
}, 10, 3 );
Placement
This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.
See also the PHP section in this article: Where Do I Put This Code?
Source Code
This filter is located in /form_display.php
Since
The filter was added in Gravity Forms 2.9.2