Request a Quote
Customer Focused
Web Services

Limit WordPress Excerpt Length

October 20, 2021
Code Category:

Just change the return to how ever many words you want included in the excerpt string.

/**
 * Filter the except length to 20 words.
 *
 * @param int $length Excerpt length.
 * @return int (Maybe) modified excerpt length.
 */
function wpdocs_custom_excerpt_length( $length ) {
    return 20;
}
add_filter( 'excerpt_length', 'wpdocs_custom_excerpt_length', 999 );
Give us a call (541) 784-5711

Start a converstation


©2022 Fotan Web Design