<?php
add_filter( 'wpforms_process_smart_tags', function ( $message, $form_data, $fields = '', $entry_id = 0 ) {
// CHANGE THIS FORM ID TO YOURS:
if ( 157 != $form_data['id'] ) {
return $message;
}
// So we are not submitting the form.
if ( empty( $entry_id ) ) {
return $message;
}
// IN THE HOPE, THAT "NAME" FIELD HAS THE ID=0:
$message_updated = preg_replace( '~{field_id="0"}~', $fields[0]['first'], $message, 1 );
if ( is_null( $message_updated ) ) {
return $message;
}
return $message_updated;
}, ~PHP_INT_MAX, 4 );