Heads up!
This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.
This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.
This hook is called before validation happens. If you exclude a field here, it should skip validation.
Usage
add_filter( 'frm_fields_to_validate', 'skip_validation_for_a_specific_field');
Parameters
- $fields (array)
- $args (array)
Examples
Skip validation for a specific field
add_filter( 'frm_fields_to_validate', 'skip_validation_for_a_specific_field', 10, 2 );
function skip_validation_for_a_specific_field( $fields, $args ) {
$target_form_id = 220; // change 220 to the ID of the form
if ( $target_form_id === (int) $args['values']['form_id'] ) {
$field_id_to_remove = 1204; // change 1204 to the ID of the field to skip
foreach ( $fields as $key => $field ) {
if ( $field_id_to_remove === (int) $field->id ) {
unset( $fields[ $key ] );
break;
}
}
}
return $fields;
}