### [wpforms_frontend_confirmation_message](https://wpforms.com/developers/wpforms_frontend_confirmation_message/)

**Published:** August 4, 2020
**Author:** Editorial Team

**Excerpt:** The wpforms_frontend_confirmation_message filter is applied to all forms to display a confirmation message. Use this to replace the form's message.

**Content:**

## Description

Filters confirmation message output site-wide.

## Parameters

$message*(string) (Required)* Confirmation message, including processed Smart Tags.$form\_data*(array) (Required)* Processed form settings/data, prepared to be used later.$fields*(array) (Required)* Sanitized field data.$entry\_id*(int) (Required)* Entry id.## Source

`wpforms/src/Frontend/Frontend.php`

## More Information

The filter is applied to all forms set to display a [confirmation message](https://wpforms.com/docs/setup-form-confirmation-wpforms/ "How to Set Up Form Confirmation in WPForms"). It can be used to change or replace the confirmation message that’s displayed, overriding the message contents set within the form builder.

## Examples

The example shown below will capture the user name that filled out the form and then give a more personalized message for the confirmation message.

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

```

/**
 * Filters confirmation message output site-wide.
 *
 * @link   https://wpforms.com/developers/wpforms_frontend_confirmation_message/
 * 
 * @param  string   $message     Confirmation message including Smart Tags.
 * @param  array    $form_data   Form data and settings.
 * @param  array    $fields      Sanitized field data.
 * @param  int      $entry_id    Entry ID.
 *
 * @return string
 */

function wpf_dev_frontend_confirmation_message( $message, $form_data, $fields, $entry_id ) {
    
    // Only run on my form with ID = 25
    if ( absint( $form_data[ 'id' ] ) !== 25 ) {
            return $message;
        } 

    // also it is possible to access the first, middle, and the last name as follows inplace of [ 'value' ]
    //  $contact_name = $fields[ '0' ][ 'first' ]; - this will pass in the first name
    //  $contact_name = $fields[ '0' ][ 'last' ]; - this will pass in the last name
    //  $contact_name = $fields[ '0' ][ 'middle' ]; - this will pass in the middle name in the format First Middle Last
         
    // Get the name field ID '0' to set the name for the message
    $contact_name = $fields[ '0' ][ 'value' ];
    
    // Add the name to the message
    $message = __('Thanks ' . $contact_name .  ' we will be in touch!', 'plugin-domain');
    return $message;
     
}
add_filter( 'wpforms_frontend_confirmation_message', 'wpf_dev_frontend_confirmation_message', 10, 4 );
```

## Reference Articles

- [How to Show All Fields in Your Confirmation Message](https://wpforms.com/developers/how-to-show-all-fields-in-your-confirmation-message/ "How to Show All Fields in Your Confirmation Message")
- [How to Get the URL from the File Upload Form Field](https://wpforms.com/developers/how-to-get-the-url-from-the-file-upload-form-field/ "How to Get the URL from the File Upload Form Field")
- [How to Create a Quiz Form](https://wpforms.com/developers/how-to-create-a-quiz-form/ "How to Create a Quiz Form")

**Categories:** Filters Hooks

**Tags:** PHP

---

