Description

Action that fires just after the submit button element is displayed.

Parameters

$form_data
(array) Processed form settings/data, prepared to be used later.

Source

wpforms/includes/class-frontend.php

More Information

The wpforms_display_submit_after hook fires within the form’s submit button container div, after the submit button element is displayed.

As an example, you can use this hook to add HTML that’s output after the submit button.

As an alternative, you could use the wpforms_display_submit_before to display something before the submit button.

Examples

In our example code snippet you’ll see below, we are going to be checking first to see if the form ID is equal to 5. If it is, then echo out a link to a video that will open in a lightbox just after our submit button is shown on the page.

Just remember to change the form ID from 5 to match the specific form ID you’re wanting to run your code on. Removing that check would run for all forms.

/**
 * Action that fires just after the submit button element is displayed.
 * 
 * @link  https://wpforms.com/developers/wpforms_display_submit_after/
 * 
 * @param array  $form_data Form data and settings
 */
function wpf_dev_display_submit_after( $form_data ) {
 
    // Only run on my form with ID = 5
    if ( absint( $form_data['id'] ) !== 5 ) {
            return;
        } 
 		
    // Run code or see example echo statement below.
    _e( '<div class="track-click"> <a href="https://www.youtube.com/watch?v=eiQ3viAGung" data-rel=”lightbox”>Click here for a special video announcement!</a>.</div>', 'plugin-domain' );
}
add_filter( 'wpforms_display_submit_after', 'wpf_dev_display_submit_after', 10, 1 );