How to limit acf field value in WordPress

If you want to limit the ACF field character output. you can use below code.

1) Make sure to use get_field instead of the_field to get the value.

$field = get_field('acf_field_name');
echo substr($field, 0, 200); 

2) I would recommend using the built in WP function wp_trim_words

$excerpt = wp_trim_words( get_field('acf_field_name' ), 
$num_words = 50, $more = '...' ); 

Leave a Reply

Your email address will not be published. Required fields are marked *