Support

Account

Home Forums Feature Requests Set max length for editor Reply To: Set max length for editor

  • Hi @rshmiraf

    For WYSIWYG field, I believe you can do it like this:

    add_filter('acf/validate_value/name=wysiwyg_field_name', 'my_acf_validate_value', 10, 4);
    
    function my_acf_validate_value( $valid, $value, $field, $input ){
        
        // bail early if value is already invalid
        if( !$valid ) {
            
            return $valid;
            
        }
        
        if( strlen($value) > 40 ) {
            
            $valid = 'You can\'t enter more that 40 chars';
            
        }
        
        
        // return
        return $valid;
        
        
    }

    If still no joy, could you please share the code you have?

    Thanks 🙂