Description

The wpforms_wp_footer action is triggered at the end of the page load only if a form created with WPForms is found on the page.

Parameters

This action does not accept any parameters.

More Information

This action works much like the standard WordPress wp_footer action. It will run at the end of the page load, but specifically for the wpforms_wp_footer action, it will only fire if there is a form created with WPForms found on that page.

This is especially useful if you have any custom JavaScript or custom CSS on the page but you don’t want that code to run if there isn’t a WPForms on the page.

Source

wpforms/includes/class-frontend.php

Examples

This example is pulled from a snippet reference (link shown below) and it’s using Javascript and the wpforms_wp_footer action to disable the scroll animation on multi-page forms.

/**
 * Change the captcha theme for the Google Checkbox v2 reCAPTCHA
 *
 * @link https://wpforms.com/developers/how-to-change-the-captcha-theme-on-google-checkbox-v2-recaptcha/
 */
 
function wpf_dev_disable_multipage_scroll() {
    ?>

    <script type="text/javascript">window.wpforms_pageScroll = false;</script>

    <?php
}
add_action( 'wpforms_wp_footer', 'wpf_dev_disable_multipage_scroll', 30 );

Article References: