mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-04-29 11:32:21 +08:00
17 lines
618 B
Text
17 lines
618 B
Text
add_filter('fluentform/validation_errors', function ($errors, $data, $form) {
|
|
$targetFormId = 1; // 1 is your target form ID
|
|
if($form->id != $targetFormId) {
|
|
return $targetFormId;
|
|
}
|
|
|
|
$primaryInputName = 'email'; // Your primary email input name
|
|
$conformInputName = 'confirm_email'; // Your confirm email input name
|
|
|
|
if($data[$primaryInputName] != $data[$conformInputName]) {
|
|
if(!isset( $errors[$conformInputName])) {
|
|
$errors[$conformInputName] = [];
|
|
}
|
|
$errors[$conformInputName][] = 'Confirm Email needs to be matched with primary email';
|
|
}
|
|
return $errors;
|
|
}, 10, 3);
|