The gform_disable_print_form_scripts filter can be used to prevent scripts and stylesheets from being printed when using Gravity Forms PHP.
Usage
add_filter('gform_disable_print_form_scripts', 'your_function_name');
Parameters
- $disable_print_form_script (bool): Should printing of the scripts and stylesheets be disabled? Default is false.
- $form (Form Object): The form object for the shortcode being processed.
- $is_ajax (bool): Indicates if AJAX was enabled on the shortcode.
More information
See Gravity Forms Docs: gform_disable_print_form_scripts
Examples
Disable printing of scripts and stylesheets for all forms
add_filter('gform_disable_print_form_scripts', '__return_true');
Target a specific form
add_filter('gform_disable_print_form_scripts', 'disable_print_form_scripts', 10, 2);
function disable_print_form_scripts($disable_print_form_script, $form) {
if ($form['id'] == 10) {
return true;
}
return $disable_print_form_script;
}
Place this code in the functions.php file of your active theme.
This filter was added in Gravity Forms 2.0. The filter is located in GFCommon::gform_do_shortcode() in common.php.