Replies: 0
I have a problem with a filter: I created a mu-plugin with this code to validate a field hidden by css that must remain empty (as an antibot field):
add_filter( 'forminator_custom_form_submit_errors', 'check_form_data', 99, 3 );
function check_form_data( $submit_errors, $form_id, $field_data_array ) {
$valid = false;
$antibotFieldName = "";
foreach( $field_data_array as $val ) {
if( $val['placeholder'] == 'antibot' ) {
$antibotVal = $val['value'];
$antibotFieldName = $val['name'];
if($antibotVal == ""){
$valid = true;
}
break;
}
}
if( ! $valid ) {
$submit_errors[][$antibotFieldName] = 'Antibot verifica fallita!';
}
return $submit_errors;
}
but I can’t make it work, it’s ignored..am I missing something?
Thanks