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.
Field options are now validated by default. If this is causing issues, use this filter to revert the update.
Usage
add_filter( 'frm_option_is_valid', '__return_true' );
Parameters
- $is_valid (bool)
- $value (array|string)
- $field (object)
Examples
Change field options validation
Field options are now validated by default. To revert this, use this code example.
add_filter( 'frm_option_is_valid', '__return_true' );
Add exception for option validation in REST API
Use this code snippet to add an exception for option validation when using the Formidable REST API to create or update entries.
add_filter(
'frm_option_is_valid',
function( $valid ) {
if ( ! $valid ) {
$uri = FrmAppHelper::get_server_value( 'REQUEST_URI' );
if ( 0 === strpos( $uri, '/wp-json/frm/v2/entries/' ) ) {
$valid = true;
}
}
return $valid;
}
);
Add exemptions only for specific field IDs
Use this code example that will allow you to add exemptions only for specific field IDs.
add_filter( 'frm_option_is_valid', function( $is_valid, $value, $field ) {
if ( ! $is_valid ) {
$field_id_exceptions = array( 1, 2, 3 );
if ( in_array( (int) $field->id, $field_id_exceptions, true ) ) {
$is_valid = true;
}
}
return $is_valid;
}, 10, 3 );