<?php
add_filter( 'wpforms_frontend_strings', function( $strings ) {
global $post;
if ( ! isset( $post->post_content ) ) {
return $strings;
}
preg_match( '~\[wpforms id=\"(\d+)\"~', $post->post_content, $matches );
if ( ! is_array( $matches ) || ! isset( $matches[1] ) ) {
return $strings;
}
$form_id = (int) $matches[1];
// This form ID should be changed and the text below it as well.
if ( 181 === $form_id ) {
$strings['val_required'] = 'PUT HERE YOUR CUSTOM TEXT';
}
return $strings;
} );