// Trim custom excerpts
add_filter( 'wpex_excerpt_output', function( $output, $args ) {
if ( $output && ! empty( $args['custom_excerpts'] ) ) {
$post = get_post();
$post_id = $post->ID;
if ( $post->post_excerpt ) {
$output = wp_trim_words( $post->post_excerpt, $args['length'], $args['more'] );
}
}
return $output;
}, 10, 2 );