Description
The wpforms_frontend_js_header_force_load
filter allows forcing the load of JavaScript assets in the header instead of the footer for WPForms.
Parameters
- $in_footer
- (bool) (Optional) Determines whether to print the script in the footer, default is
false
.
Source
wpforms/includes/functions/forms.php
More Information
This filter is applied to determine whether WPForms JavaScript files should be loaded in the header or footer of the page. By default, the filter is called with false
, which means scripts would be loaded in the footer. Returning true
from the filter would cause scripts to be loaded in the header.
Note: This filter is specific to JavaScript assets and does not affect CSS loading.
Example
/**
* Force WPForms JavaScript to load in the header.
*
* @link https://wpforms.com/developers/wpforms_frontend_js_header_force_load
*
* @param bool $in_footer Whether to load scripts in the footer.
* @return bool
*/
add_filter( 'wpforms_frontend_js_header_force_load', '__return_true' );