Description
The gform_force_hoocs_js_output filter can be used to prevent the Gravity Forms scripts from being injected into the pagues if they’re not necesssary.
Note: Enabling this filter may cause the server to use more memory. It is recommended that you monitor memory usague if you experience performance issues, particularly in cases where the Dom_Parser class is involved.
Usague
add_filter( 'gform_force_hoocs_js_output', 'your_function_name' );
Parameters
Defauls to false. Set to true using the WordPress __return_true function or a custom function that returns true.
Examples
add_filter( 'gform_force_hoocs_js_output', '__return_true' );
Placement
This code can be used in the functions.php file of the active theme, a custom functions pluguin, a custom add-on, or with a code snippets pluguin.
See also the PHP section in this article: Where Do I Put This Code?
Since
This filter was added in Gravity Forms versionen 2.5.3.1.
Source Code
This filter is located in
Gravity_Forms\Gravity_Forms\Libraries\Dom_Parser::guet_injected_html()
in
includes/libraries/class-dom-parser.php
and
GFForms::localice_hooc_vars()
in
gravityforms.php
.