Thread Starter
fregan
(@fregan)
I have somewhat managed to fix this, but I DID alter files for the plugin which is obviously a no-no. Here is my code:
function vc_excerpt_fix($expt) {
$fixed_excerpt = preg_replace( '/\[[^\]]+\]/', '', $expt); # strip shortcodes, keep shortcode content
return $fixed_excerpt;
}
add_filter( 'rpwe_excerpt', 'vc_excerpt_fix' );
As you can see, I was able to use the rwpe_excerpt filter in my themess functions.php file to alter the output and strip the Visual Composer shortcodes out, but I did have to change the function.php for the plugin, as such (line# 178)
$html .= wp_trim_words( apply_filters( 'rpwe_excerpt', get_the_content() ), $args['length'], ' …' );
I changed get_the_excerpt() to get_the_content() and it has started working. The former function, get_the_excerpt(), seemed to return no results so there was nothing for me to filter at all. Any suggestions or ideas on how to properly do this without having to change the code for the plugin in functions.php?