[Resolved] Excerpt Field Length

Home Forums Support Excerpt Field Length

This topic contains 3 replies, has 2 voices, and was last updated by  David 1 week, 6 days ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #1285510


    Is there a filter for setting the max number of words displayed from the Excerpt Field? (not the excerpt auto-generated by WordPress/Theme)


    David Customer Support

    Hi there,

    may i ask why you want to do that when you could just type a shorter excerpt?



    Only because they are job vacancy posts and as theres likely to be alot of them I’m not sure the client would want to check how many words they are writing everytime they publish a post.


    David Customer Support

    I suppose you could re-purpose this function:


    Something like this:

    add_filter( 'wp_trim_excerpt', 'tu_excerpt_metabox_more' );
    function tu_excerpt_metabox_more( $excerpt ) {
        $output = $excerpt;	
        if ( has_excerpt() ) {
            $output = sprintf( '%1$s <a href="%2$s">%3$s</a>',
                wp_trim_words( $excerpt, 15),
                __( 'Read more', 'generatepress' )
        return $output;

    This wp_trim_words( $excerpt, 15) is what sets the number of words to display

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.