WordPress Limit excerpt length to 50 words


Example

Put the following code in functions.php:

function themify_custom_excerpt_length( $length ) {
   return 50;
}
add_filter( 'excerpt_length', 'themify_custom_excerpt_length', 999 );

Use 999 as the priority to ensure that the function runs after the default WordPress filter, otherwise it would override what is set here.