Because this discussion kept coming up in my searches to do a basic change of the excerpt length, I’ll highlight the specific code to add to a theme’s functions.php file:
function custom_excerpt_length( $length ) {
return 20;
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
Note the third argument in the call to add_filter(). It doesn’t work without it. I updated the code snippet I found on the the_excerpt
in the Codex that didn’t have it, and therefore frustrated me almost no-end.