Skip to content

Instantly share code, notes, and snippets.

@New0
Last active September 20, 2019 13:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save New0/be22a63af2fbc1ff005a503b24604033 to your computer and use it in GitHub Desktop.
Save New0/be22a63af2fbc1ff005a503b24604033 to your computer and use it in GitHub Desktop.
Plugin to set the maxlength to multiple Caldera Forms paragraphs fields
<?php
/**
* Plugin Name: CF paragraph settings
*
*/
add_filter( 'caldera_forms_field_attributes', function( $attrs, $field, $form ){
//Set the field IDs here
$fields = [ 'fld_456', 'fld_457', 'fld_458' ];
if( in_array( $field[ 'ID' ], $fields) && 'paragraph' === Caldera_Forms_Field_Util::get_type( $field, $form ) ){
$attrs[ 'maxlength' ] = 75;
}
return $attrs;
}, 20, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment