Limit Character Count in ACF Repeater Text Field

April 7, 2013

Limiting the characters in a given field is a good way to dummyproof your admin dashboard so content writers don’t write novel length entries for a field that should only be a few words. This could have consequences such as ruining the integrity of the design and brand the company wishes to achieve. So limiting the length of the content they can write is a good way to make sure things like that don’t happen.

However, this is not a feature supported by the ACF plugin at the moment. So there is a work around that can get the desired effect until they do. Just put this code in your functions.php file:

<?php function my_head_input() { ?>
<script type="text/javascript">
    jQuery('.repeater textarea').css("min-height","5px");
    jQuery('.repeater textarea').on('keyup', function(){
    var characters = 30;
    if( jQuery(this).val().length > characters ){
      jQuery(this).val(jQuery(this).val().substr(0, characters));
      return false;
<?php }
add_action('acf/input/admin_head' , 'my_head_input' );

this solution was tailored to the textarea fields of all repeater fields. You can play with the jQuery selector to affect the fields you desire

Stay in Touch!

Subscribe to our newsletter.

Solutions Architecture

browse through our blog articles

Blog Archive