Created
April 21, 2016 08:27
-
-
Save yratof/8e1cb96c5bdc14e439ad5cadde263b98 to your computer and use it in GitHub Desktop.
Visual Composer and Relevanssi showing shortcodes in search
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Issue with showing VC shortcodes in search results | |
// Strip out Visual Composer specific shortcodes | |
add_filter('relevanssi_pre_excerpt_content', 'rlv_trim_vc_shortcodes'); | |
function rlv_trim_vc_shortcodes($content) { | |
$content = preg_replace('/\[\/?vc_.*?\]/', '', $content); | |
return $content; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Still helpful to hide other particular shortcodes though by replacing the "vc_" text. Thanks!