Hi atozsoft.net,
shortcodes are not “rendered” in the excerpt but unfortunately shows the shortcode.
You can try to add this filter in the “functions.php” file of the theme:
function modify_excerpt( $text ) {
$text = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $text);
return $text;
}
add_filter( 'the_excerpt', 'modify_excerpt' );
This should remove shortcodes from excerpt.
Best Regards,
CrestaProject
Yes you’re right, in that function I did not use “the_excerpt()” function.
I’ll fix this in the next theme update, so you can use the function that I gave you in the previous answer 🙂
Best Regards,
CrestaProject
Hi atozsoft.net,
I think this code will solve your problem:
function modify_excerpt( $text ) {
$text = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $text);
return $text;
}
add_filter( 'wp_trim_words', 'modify_excerpt' );
Best Regards,
CrestaProject