function my_custom_excerpt_length( $length ) {
    return 20; // Устанавливаем длину в 20 слов
}
add_filter( 'excerpt_length', 'my_custom_excerpt_length' );