Home Forums General Issues Limit the_field output to x chars


Limit the_field output to x chars

  • I currently have the following code to load an intro paragraph ACF field and if empty to load the excerpt:

    if( get_field('intro_paragraph') ) {
    } else {

    This as some older posts do not have the ACF Intro field populated. The excerpt it limited to 30 chars:

    function custom_excerpt_length( $length ) {
        return 30;
    add_filter( 'excerpt_length', __NAMESPACE__ . '\\custom_excerpt_length', 999);

    How can limit the output of a field to x amount of characters?

Viewing 1 post (of 1 total)

The topic ‘Limit the_field output to x chars’ is closed to new replies.