When utilizing shortcode (plugin, etc.) near the top of the page, the plugin shortcode displays in the preview. Is there a way to hide text within brackets from a preview on a recent posts type of page?
The following example shows the shortcode within a blog post preview:
4 Answers
You can do with PHP. Just remove part where is get_content()
and add this:
<?php
$content=get_the_content();
$content = preg_replace('#\[[^\]]+\]#', '',$content);
echo apply_filters('the_content', $content);
?>
That is regular expression added inside content. This regex will remove all tags inside content.