| CARVIEW |
Select Language
HTTP/2 301
date: Sat, 27 Dec 2025 02:15:58 GMT
content-type: text/html; charset=UTF-8
location: https://docs.gravityforms.com/gform_print_scripts/
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: 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=Q3RtTlqczp05KwKW3KPXHqp9qMZGAgJN0IC1vsESY4GFUYJANfm2G%2B6NGOYVYBBhsfHvb2YS0zRwZ4QWUS75pJvHGWGQfd%2FqQwxKv%2FJfulUbLgh4"}]}
cf-ray: 9b455028f9cb3e92-BLR
HTTP/2 200
date: Sat, 27 Dec 2025 02:15:59 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: HIT
report-to: {"group":"cf-nel","max_age":604800,"endpoints":[{"url":"https://a.nel.cloudflare.com/report/v4?s=MhI3hLyhNHaOOdK7fw67nVjDdyBATC4mR0vYOHMR3%2FUvzf0SSImqKSB9pDYfPW8CuzKG6dHc9LQuS4T3e1ygJL97zyhcXYj5QL%2FpsWqVdXVubVlS"}]}
cf-cache-status: DYNAMIC
nel: {"report_to":"cf-nel","success_fraction":0.0,"max_age":604800}
content-encoding: gzip
cf-ray: 9b45502f38f63e92-BLR
gform_print_scripts - Gravity Forms Documentation
gform_print_scripts
Description
The gform_print_scripts action hook is executed just after the scripts are printed to the page for the form widget or when a form embed is processed in a custom location using GFCommon::gform_do_shortcode().
Usage
add_action( 'gform_print_scripts', 'your_function_name', 10, 2 );
You can also specify this per form by adding the form id after the hook name.
add_action( 'gform_print_scripts_6', 'your_function_name', 10, 2 );
Parameters
- $form Form Object
The current form object.
-
$is_ajax bool
Indicates if the form is configured to be submitted via AJAX.
Examples
1. Print custom script
This example prints a custom script for all AJAX enabled forms.
add_action( 'gform_print_scripts', 'print_custom_script', 10, 2 );
function print_custom_script( $form, $is_ajax ) {
if ( $is_ajax ) {
wp_enqueue_script( 'custom_script', 'path/file.js' );
wp_print_scripts( 'custom_script' );
}
}
Placement
This code should be placed in the functions.php file of your active theme or a custom functions plugin.
Since
This filter was added in Gravity Forms v2.5.
Source Code
This filter is located in GFFormDisplay::print_form_scripts() in form_display.php.