| CARVIEW |
Select Language
HTTP/2 301
date: Sat, 27 Dec 2025 06:46:35 GMT
content-type: text/html; charset=UTF-8
location: https://docs.gravityforms.com/gform_date_max_year/
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
content-security-policy: frame-ancestors 'self';
referrer-policy: no-referrer
referrer-policy: strict-origin-when-cross-origin
x-redirect-by: WordPress
fastcgi-cache: HIT
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=FkF9ZBUXbTbpsaiM4TvoBV6%2FtZwCaQ2hl08F66K4cGjvg64LNB9TP4DZyFjstnA4Qb1hNaKsDyTVs40sqCh9ePBZ25VP1OXDNPPjzqvdRnDTQ24c"}]}
cf-ray: 9b46dc932e8758e1-BLR
HTTP/2 200
date: Sat, 27 Dec 2025 06:46:36 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
content-security-policy: frame-ancestors 'self';
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: EXPIRED
report-to: {"group":"cf-nel","max_age":604800,"endpoints":[{"url":"https://a.nel.cloudflare.com/report/v4?s=K%2FNqN2yg5IVZT%2Ba2AqFva5vTPE45UkeO0dEwHgYtqT0ngFDYgr6nhiy1CTxaoe5xYlx4Edira0%2F4Mv5cj8fw8PEc3%2BhibAYzVZedmnZALsbxruPu"}]}
cf-cache-status: DYNAMIC
nel: {"report_to":"cf-nel","success_fraction":0.0,"max_age":604800}
content-encoding: gzip
cf-ray: 9b46dc953a9858e1-BLR
gform_date_max_year - Gravity Forms Documentation
gform_date_max_year
Description
Use this filter to specify the maximum year displayed in the date field’s year drop down and the HTML5 max attribute for the date field’s year input.
Usage
add_filter( 'gform_date_max_year' , 'set_max_year' );
Parameters
- $max_date string
The maximum date to be filtered. Defaults to the current year plus one. - $form array
Current form object. - $field array
Current field object.
Examples
This example changes the max date to 2022.
add_filter( 'gform_date_max_year', 'set_max_year' );
function set_max_year( $max_date ) {
return 2022;
}
This example changes the max date for a specific field on a specific form.
add_filter( 'gform_date_max_year', function ( $max_date, $form, $field ) {
return $form['id'] == 7 && $field->id == 5 ? 2022 : $max_date;
}, 10, 3 );
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in the following methods in includes/fields/class-gf-field-date.php:
- GF_Field_Date::get_field_input()
- GF_Field_Date::get_year_dropdown()