Description

The wpforms_frontend_output_after action fires after a form is displayed on the site’s front end, only if the form exists and contains fields.

Parameters

$form_data
(array) Processed form settings/data, prepared to be used later.
$form
(WP_Post) Form post type object.

Source

wpforms/src/Frontend/Frontend.php

More Information

While wpforms_frontend_output_after only fires for valid non-empty forms, it executes after the output rendering process.

An alternate action to consider is wpforms_frontend_output_before, as it functions similarly, except only fires before the form is displayed.

Examples

An example to use this particular action may be to display a link just after the Submit button on the form.

Just remember to change the form ID from 731 to match the specific form ID you’re wanting to run your code on as well as the images directory (if calling an image) to match that of your theme structure.

If you need help in finding your form ID, please review this tutorial.

/**
 * Output something after your form(s).
 *
 * @link  https://wpforms.com/developers/wpforms_frontend_output_after/
 *
 * @param array  $form_data Form data and settings.
 * @param object $form      Form post type object.
 */

function wpf_dev_frontend_output_after( $form_data, $form ) {
    
    // Optional, you can limit to specific forms. Below, we restrict output to
    // form #731.
    if ( absint( $form_data[ 'id' ] ) !== 731 ) {
        return;
    } 

    // Run code or see the example echo statement below.
    _e( 'Click here for our Black Friday Offers!  <a href="http://yourlinkurl.com/black-friday" target="_blank">Check out our Black Friday deals!</a>.', 'plugin-domain' );

}
add_action( 'wpforms_frontend_output_after', 'wpf_dev_frontend_output_after', 10, 2 );

Reference Articles